ChatGPT解决这个技术问题 Extra ChatGPT

Error: Node Sass does not yet support your current environment: Windows 64-bit with false

E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj>ionic serve -l
(node:4772) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
There is an error in your gulpfile:
Error: Node Sass does not yet support your current environment: Windows 64-bit with false
For more information on which environments are supported please see:
TODO URL
    at Object.<anonymous> (E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj\node_modules\node-sass\lib\index.js:12:11)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj\node_modules\gulp-sass\index.js:187:21)
    at Module._compile (module.js:541:32)
run npm rebuild node-sass or sudo npm rebuild node-sass

P
Pmpr.ir

This error message does not indicate a problem with Ionic, but rather with node-sass, which is specified to execute in your Gulp file.

The node-sass error:

Node Sass does not yet support your current environment

indicates that the version of node-sass you are trying to run is not compatible with the version of node installed.

Check the Node Sass release notes for the version of node-sass you have, to see which version of node is required.

If the version of node is wrong, you must downgrade node, or upgrade node-sass, until you have a compatible pair. If the node version is supported, you may just need to run:

npm rebuild node-sass

(with -g if node-sass was installed globally).

If that doesn't work, you can:

npm uninstall node-sass && npm install node-sass

(again, with -g if necessary).

This github issue has lots of more info on this.


deleted node_modules and performed yarn install which rebuilt the node-sass (and other libs) with the new version of the node. Thanks.
you can npm uninstall node-sass && npm install node-sass, this worked for me
Use npm un node-sass && npm i node-sass -D if you have node-sass in your devDependencies.
@oyalhi worked for me but only after I also removed the yarn.lock file
I tried "npm rebuild node-sass", then "npm uninstall node-sass && npm install node-sass" still didnt work. After installing it globally "npm install node-sass -g" it worked
P
Pullat Junaid

npm uninstall node-sass && npm install node-sass is the better way to fix


Works great for me thanks! Side not this showed up on an old angular 5 project one I updated the angular cli. (not sure why) If you hate node-sass say AYYY
Uninstalling and reinstalling fixes the problem. However, while installing you may need to specify the version being installed. e.g npm install node-sass@4.14.1 which installs the latest version before 5.0 to avoid the error Error: Node Sass version 5.0.0 is incompatible with ^4.0.0
If you use yarn then these would be the appropriate commands: yarn remove node-sass && yarn add node-sass
E
Enayat

Removing node_modules and running npm install fixed those errors for me.

Others say: npm rebuild node-sass or npm audit fix might help.


Run npm config set msvs_version 2015 --global after installing Visual Studio Build Tools and before running npm install or npm rebuild node-sass. See here for more details.
I also had to run npm audit fix in order to get everything working
@ADTC - Thanks! the npm config setting worked the magic for me (I've installed VS2019 since I last compiled this project).
c
curiousBoy

None of the above worked for me. I completely removed and than re-installed and it solved the issue.

To delete existing:

npm uninstall --save-dev node-sass 

Then to re-install:

npm install --save-dev node-sass

Р
Руслан

Here are node and node-sass compatible versions list.

NodeJS  Supported node-sass version *
Node    15        5.0+   
Node    14        4.14+ 
Node    13        4.13+, < 5.0   
Node    12        4.12+  
Node    11        4.10+, < 5.0   
Node    10        4.9+   
Node     8        4.5.3+, < 5.0  
Node  <  8   <    5.0     < 57

If issue exists, upgrade or downgrade versions.


And we can easily manage node version with this package npmjs.com/package/n
node-sass currently deprecated
R
Royalty

In my situation problem was in the version of node. As I used the newest version 16.0.0 but the version of node-sass was old (4.14.1), I downgraded node to 14.15.5 (nvm install 14.15.5), ran npm install node-sass@4.14.1, rebuilt node npm rebuild node-sass and just then started my app npm start. Worked!

Steps:

nvm install 14.15.5 (downgrade node to version that satisfies node-sass) nvm use 14.15.5 npm install node-sass@4.14.1 (reinstall node-sass) npm rebuild node-sass npm start


Changing node version with nvm helped
G
Gopala raja naika

Please try this once if the above answers not fixed your issue

npm uninstall node-sass
npm install node-sass@4.14.1

Source: here


A
Avjol Sakaj

I tried this but it didn't work for me and threw errors:

npm --depth 9999 update 
npm rebuild node-sass

I have installed the latest Node.js (which for the moment is 11.11.0 Current), after facing this problem I just did the following:

downgrade to recommended version (which for the moment is 10.15.3 LTS) you can get it from NodeJS, deleted node_modules and then reinstall yarn:

     yarn install
     yarn start

After executing these commands everything is working fine for me.


For me it worked only by executing the command npm rebuild node-sass. Thanks.
N
Nipun Tharuksha

Check the Node Sass release notes for the version of node-sass you have, to see which version of node is required. If the version of node is wrong, you must downgrade node, or upgrade node-sass, until you have a compatible pair. If the node version is supported, you may just need to run npm rebuild node-sass.If that doesn't work, you can npm uninstall node-sass or npm install node-sass


S
SergioZhydecky

If you have an old project built with node 8 you have to run under node 8:

$npm rebuild node-sass

then switch to node 10 or higher and run:

$npm uninstall node-sass && npm install node-sass

after these actions everything works fine for me. If I do it under node 8 or node 10 and higher, it does not fix the issue in the project. Could be it will help someone :)


n
nscalf

Ran into this issue, npm i @ionic/app-scripts was the only thing that worked.


H
Haris George

The below code worked for me. Try using this in terminal

npm uninstall node-sass && npm install node-sass

You can add -g to it if you want to install it globally


j
jizhihaoSAMA

for visual studio 2019 need change MSBuild path

npm config set msvs_version 2017

npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"

npm rebuild node-sass

This one helped me.
I had to change the path from Professional to Community, but otherwise, this was what worked for me to get to the next error.
F
Fernando Nogueira

Try this:

npm --depth 9999 update
npm rebuild node-sass

a
amdg

The link from the stack trace below helped me in resolving this issue.

Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (64)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.7.2

This link(https://github.com/sass/node-sass/releases/tag/v4.7.2) clearly shows node versions which are supported.

    OS      Architecture    Node
    Windows x86 & x64       0.10, 0.12, 1, 2, 3, 4, 5, 6, 7, 8, 9
    ...     ...             ...    

After downgrading the node version to 8.11.1, executed npm install again. Got the following message.

Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 8.x

Found bindings for the following environments:
  - Windows 64-bit with Unsupported runtime (64)

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.

Finally,ran npm rebuild node-sass --force as instructed and all started working


s
smsmware

rolling back to node v10.17.0 fixed the problem to me.

You can use nvm to do so:

https://github.com/nvm-sh/nvm

> nvm install 10.17.0
> nvm use 10.17.0
> node -v
10.17.0

D
Dharman

I had a similar error with the sass package, I fixed it by following the steps:

After having identified that the error was due to the incompatibility of the versions, list the available ones:

npm view node-sass versions

https://i.stack.imgur.com/noX0k.png

I had the version '5.0.0', so I proceeded to downgrade it to the previous one ('4.14.1' in my case):

npm uninstall node-sass

npm install node-sass@4.14.1

And voila, only one version step was necessary, in other cases it may be several depending on the age or needs of the project.


H
Husain Ali

I got this error, with angular 7, what helped me is, From the windows power shell I run the command:

npm install --global --production windows-build-tools

then again I reopen my VS Code, on it's terminal I run the same command npm uninstall node-sass and npm install node-sass


Z
Zsolt Meszaros

I had the same problem and I solved it as follows:

check the node-sass version used in the current project go to node-sass release: "https://github.com/sass/node-sass/releases/tag/v@.@.@" (put your node-sass version here) check the Supported Environment table and see if your Node version exist in it if it is not, downgrade your node version to the latest version existing in the table

I know it's not the perfect solution but I didn't find anything else in my case.


This is the solution for my macOs. I checked the tags until I fond the one what supports my OS version. I just had to replace it into package.json, remove node_modules and run yarn.
D
Dragos Lupei

I installed the latest version which at the moment of writing this comment is 5.0.0

npm install node-sass@latest


j
jimmymadon

If you use NVM, VS Code and the VS Code Task Explorer to run npm scripts that use node-sass, the below caveat should save you some hours of head-banging.

I was using VS Code's Task Explorer to run my scripts and have installed multiple Node versions using NVM, defaulting to the current latest version 16. When I opened my VS Code repository and ran nvm use 10 in a new terminal, the Node and npm version in that terminal window correctly downgrades, but the version of node/npm used by the Task Explorer runner remained at Node 16. So when running my webpack script using the VS Code Task Runner, node-sass would still throw the environment error of this question.

Solution is to either not use the VS Code Task Runner and run your script in the terminal where you changed your node version or change the default NVM Node version using the below command, restart VS Code and then use the Task Explorer / Runner.

nvm alias default 10 (or whatever version you need for node-sass compatibility)


T
Tarun Kumar

In my case the issue was when I installation of the node latest version i.e; 10.6.0. The same error was showing and with reference to @Quinn Uninstalled that version and installed the 8.11.3 LTS version. Now working Fine :)


damn tested all the previous solutions but only yours worked :) the 8.11.3 version worked
M
Mike

None of above solutions worked as I faced error while rebuilding the node-sass with npm rebuild node-sass or reinstall or uninstall/install.

The solution was to upgrade GCC (g++) version to the latests 7.3.1 instead of my previously installed 4.8.5.

Older 4.8.5 didn't support command line option '-std=c++14' which is used while compiling node-sass on installation.

So just upgrade gcc and then use any solution with node rebuild node-sass or any other mentioned above.


S
Siddharth

I upgraded npm from 6.4.12 to 7.14.0, this error went away. And then I got another error

Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.

I searched for a solution and found it here. I uninstalled node sass 5.0.0 and installed 4.14.1 (apparently this is the latest 4 version of node sass, verified with npm view node-sass versions command).

This gave me a truck load of errors. npm install node-sass@

4.14.1npm ERR! code 1
npm ERR! path /home/<subfolder>/commonreact/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
.. 2000 lines of Err ..
npm ERR! gyp ERR! cwd /home/<subfolder>/commonreact/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.2.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/<username>/.npm/_logs/2021-05-25T13_09_09_655Z-debug.log

I then tried npm audit fix --force

I get this error

npm WARN audit No fix available for cp-cli@*
npm ERR! code ETARGET
npm ERR! notarget No matching version found for object-path@1.1.5.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

I checked my package.json it had "object-path": "0.11.4",

Then I tried npm install node-sass@4.0.0

Basically stuck in hell with this issue on Ubuntu 20.04. Should have never upgraded to Ubuntu 20.04.

I will keep trying and report my finding here. I am confident of solving this issue.

Edit I downgraded npm from 7.14.0 to 6.14.12, npm start now reports Error: Node Sass version 6.0.0 is incompatible with ^4.0.0. I checked npm node_sass -v reported 6.14.12. I ran npm uninstall node-sass, and npm install node-sass@4.14.1.

binding.target.mk:133: recipe for target 'Release/obj.target/binding/src/binding.o' failed
make: *** [Release/obj.target/binding/src/binding.o] Error 1
make: Leaving directory '/home/<subfolder>/commonreact/node_modules/node-sass/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/<subfolder>/commonreact/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 4.15.0-143-generic
gyp ERR! command "/home/<subfolder>/.nvm/versions/node/v16.2.0/bin/node" "/home/<subfolder>/commonreact/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/<subfolder>/commonreact/node_modules/node-sass
gyp ERR! node -v v16.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.13.12 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-proposal-class-static-block@7.14.3 requires a peer of @babel/core@^7.12.0 but none is installed. You must install peer dependencies yourself.
npm WARN @material-ui/pickers@3.2.10 requires a peer of @date-io/core@^1.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.5.0 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/watchpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Edit Works Now I followed the steps here, and

node -v -> 16.something

nvm install lts/erbium -> sets node to 12.22.1

npm uninstall node-sass

npm install node-sass@4.14.0

AND IT WORKED


That's cool. But if you want to keep your version of node while trying to fix your node-sass issue, then you have to simply open your package.js file, then remove the node-sass dependency and just reinstall node-sass with npm uninstall node-sass and then it will install the version that is compatible with your current node version.
K
Kiryl Plyashkevich

The best solution here is to move to dart-sass because of the deprecated status of node-sass library.


Actually the right way, which also replaces other deprecated sub dependencies!
z
zhao

Try to install lower version of node if you have no other way.

find available node version

brew search node

install lower version like 12

brew install node@12

unlink existing version

brew unlink node

using new version

brew link node@12

if you got warning like "Warning: node@12 is keg-only and must be linked with --force"

brew link --force --overwrite node@10 echo 'export

update and source your config

PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile


m
minTwin

Answer from 2022. My project is using node-sass version 4.14.1. Had to downgrade my node to version 12.16.1 with the command:

npm install node@12.16.1

This fixed the issue and allows me to use webpack again.


L
Lawrence Eagles

I got this error when I updated node using NVM. to remove this run; npm rebuild node-sass


There's no need to repeat what multiple people have already said
r
remy727

In my case, it was related to the node version.

My project was using 12.18.3 but I was on 14.5.0

So npm rebuild node-sass didn't solve the issue on the wrong node version(14.5.0).

I switched to the correct version(12.18.3) so it worked.


S
Sagnik Ghosh

Inside package.json convert node-sass version to :

"node-sass": "^4.0.0"

关注公众号,不定期副业成功案例分享
Follow WeChat

Success story sharing

Want to stay one step ahead of the latest teleworks?

Subscribe Now