2

I try to install node_modules for my angular project an I get issue for node-sass I use mac os, node js version -> v16.13.2, node-sass version in project ->^4.14.1 In this image1 and image2 is package.json The error that I get is :

npm ERR! 1 warning and 1 error generated. npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1 npm ERR! gyp ERR! build error npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2 npm ERR! gyp ERR! stack at ChildProcess.onExit (../node_modules/node-gyp/lib/build.js:262:23) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) npm ERR! gyp ERR! System Darwin 20.6.0 npm ERR! gyp ERR! command "/usr/local/bin/node" ".../node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" npm ERR! gyp ERR! cwd .../node_modules/node-sass npm ERR! gyp ERR! node -v v16.13.2 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! .../.npm/_logs/2022-01-25T10_04_49_137Z-debug-0.log 

I tied this commands npm install -g node-sass, npm uninstall -g node-sass The same I tried to install latest version of node-sass

4 Answers 4

1

Just remove node-sass from your package.json ... that solved the problem for me

Sign up to request clarification or add additional context in comments.

Comments

1

I found a solution to this problem. Simply to downgrade node version and it works

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
0

You might want to run npm upgrade to have npm check for outdated version of your dependencies.

Because for node 16 you need node-sass in version 6.0+

4 Comments

If I update node-sass to 6.0+ version I get this error "Error: Node Sass version 6.0.1 is incompatible with ^4.0.0. "
It might help to first uninstall node-sass, then reinstall. So first npm uninstall node-sass and then npm i node-sass
I did it several times and nothing :(
Where do you run your web project? Since you wrote its on macOS, does that imply that you don't use a virtual host like Docker, Homestead/Valet or MAMP?
0

First solution

Make sure your node.js version is not superior to the recommended one. If not, downgrade it, and for that, you could use n package from npm:

npm install -g n n stable # If one of the commands does not pass, you may need to use sudo sudo npm install -g n sudo n stable 

Then you would wanna use sass package instead of node-sass, as it's deprecated. And for that, run those commands:

npm uninstall node-sass --save npm install sass --save 

Second solution

If you need or want node-sass for some reason, you should downgrade your nodejs version to like v14. For that you can use n package from npm:

npm install -g n n 14 # If one of the commands does not pass, you may need to use sudo sudo npm install -g n sudo n 14 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.