node-sass Issue on my angular project npm install (Mac OS) - node.js

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

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

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+

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

Related

NPM: libsass error when running install on Mac OS

I'm trying to run a legacy React app locally for the first time. I'm on a new Mac M1 with Big Sur 11.5.2. My node version is 16.9.0, and I made python3 the default (although the app seems to be looking for python2). I also upgraded CommandLineTools to the latest version.
But when I do a simple npm install, I get lots of warnings, and finally this error:
npm ERR! /Users/cd/.node-gyp/16.9.0/include/node/v8-internal.h:489:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
npm ERR! !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR! ~~~~~^~~~~~~~~~~
npm ERR! remove_cv
npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:776:50: note: 'remove_cv' declared here
npm ERR! template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
npm ERR! ^
npm ERR! 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 (/Users/cd/develop/storybook/webclient/node_modules/node-gyp/lib/build.js:262:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394: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 "/opt/homebrew/Cellar/node/16.9.0/bin/node" "/Users/cd/develop/storybook/webclient/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Users/cd/develop/storybook/webclient/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.9.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
I'm not proficient enough with node to understand exactly how to troubleshoot this, beyond the steps I've already taken. Clearly something is wrong with node-sass, so I installed it separately with:
sudo npm install --unsafe-perm -g node-sass
That works, but when I re-run npm install to get all the dependencies, I get the same error.
Upgrade node-sass to a version higher than 6.0.1 (mine was 4.0.0) solves this issue
Ref: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
try this
rm -rf node_modules package-lock.json
npm install --saveDev node-sass
npm install

Can't install node-sass package via npm

I recently used Chromebrew to install Node v4.4.0 on my Chromebook.
The node install went through great, and all of my packages installed with the exception of gulp-sass, which is dependent on node-sass.
This is the error I get after running npm install node-sass
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/chronos/user/druid/node_modules/node-sass/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.10.18
gyp ERR! command "/usr/local/bin/node" "/home/chronos/user/druid/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/chronos/user/druid/node_modules/node-sass
gyp ERR! node -v v4.4.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
Build failed
npm ERR! Linux 3.10.18
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "node-sass"
npm ERR! node v4.4.0
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
npm ERR! node-sass#3.4.2 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#3.4.2 postinstall script 'node scripts/build.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/chronos/user/druid/npm-debug.log
Any ideas why I am running into this issue?
that doesn't seem to contain the actual log. all it says is Error: make failed with exit code: 2. but if it's running make, it most likely is trying to compile code, and that requires a C/C++ compiler, and that isn't available under Chrome OS currently. you'd need to install a distro into a chroot like crouton.

Cannot install ember-cli on mac OS X

When I try to install ember-cli via npm, following the official documentation, I get this error:
9 errors generated.
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit(/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/ember-cli/node_modules/bufferutil
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ember-cli"
npm ERR! node v4.0.0
npm ERR! npm v3.3.5
npm ERR! code ELIFECYCLE
npm ERR! bufferutil#1.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil#1.1.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls bufferutil
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/sandropalmieri/npm-debug.log
I 've tried several times running the command using sudo but still getting this kind of error. Any idea of what's going on? Can you please assist? Thanks
Try adding --no-optional to your npm install command.
Are you using npm 3.3.3? See issue here: https://github.com/ember-cli/ember-cli/issues/4873
install node
node -v
v12.14.1
which npm
/usr/local/bin/npm
npm -v
6.13.4
npm install --save core-js#^3
sudo npm install -g ember-cli
which ember
/usr/local/bin/ember
ember -v
ember-cli: 3.16.0
node: 12.16.1
os: darwin x64

Yeoman webapp generator error with sass

Followed the "Get Started" instruction of Yeoman and get the latest stable npm and bower. However I'm getting the following error when running npm install
`npm install
\> node-sass#3.2.0 install /Users/zifei/Dev/projects/Woyao-
web/node_modules/grunt-sass/node_modules/node-sass
\> node scripts/install.js
Cannot download "https://github.com/sass/node-sass/releases/download
/v3.2.0/darwin-x64-45_binding.node": HTTP error 404 Not Found
\> node-sass#3.2.0 postinstall /Users/zifei/Dev/projects/Woyao-
web/node_modules/grunt-sass/node_modules/node-sass
\> node scripts/build.js
Building: /Users/zifei/.nvm/versions/io.js/v3.0.0/bin/iojs
node_modules/pangyp/bin/node-gyp rebuild --libsass_ext= --libsass_cflags=
--libsass_ldflags= --libsass_library=
gyp: /Users/zifei/.node-gyp/3.0.0/common.gypi not found (cwd: /Users/zifei
/Dev/projects/Woyao-web/node_modules/grunt-sass/node_modules/node-sass)
while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/Users/zifei/Dev/projects
/Woyao-web/node_modules/grunt-sass/node_modules/node-sass/node_modules
/pangyp/lib/configure.js:345:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:200:12)
gyp ERR! System Darwin 14.4.0
gyp ERR! command "/Users/zifei/.nvm/versions/io.js/v3.0.0/bin/iojs"
"/Users/zifei/Dev/projects/Woyao-web/node_modules/grunt-sass/node_modules
/node-sass/node_modules/pangyp/bin/node-gyp" "rebuild" "--libsass_ext="
"--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/zifei/Dev/projects/Woyao-web/node_modules/grunt-
sass/node_modules/node-sass
gyp ERR! node -v v3.0.0
gyp ERR! pangyp -v v2.2.1
gyp ERR! not ok
Build failed
npm ERR! Darwin 14.4.0
npm ERR! argv "/Users/zifei/.nvm/versions/io.js/v3.0.0/bin/iojs" "/Users
/zifei/.nvm/versions/io.js/v3.0.0/bin/npm" "install"
npm ERR! node v3.0.0
npm ERR! npm v2.13.3
npm ERR! code ELIFECYCLE
npm ERR! node-sass#3.2.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#3.2.0 postinstall script 'node
scripts/build.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/zifei/Dev/projects/Woyao-web/npm-debug.log`
Not sure exactly what is happening here, but the issue is that your computer is unable to build a native module. You can know this because the error is coming from gyp which is the native binary builder for node.
What I'd do in your case is try with another version. I see here you're using io.js 3.0.0 which is not necessarily the most stable version out there. I'd suggest trying with either another io.js version or using node.js 0.12 until the official node 4.0 release.
You can also just update npm and retry. Sometime it can be a race condition issue.

Cannot install node-sass npm module

I'm attempting to install the npm module "node-sass" on my Ubuntu 14.04 distro.
When I run
node -v
I get
v0.10.32
However, when attempting to install node-sass and harp with this command:
sudo npm install -g harp
I get the following error:
child_process: customFds option is deprecated, use stdio instead.
gyp ERR! configure error
gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
gyp ERR! stack at install (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:66:16)
gyp ERR! stack at Object.self.commands.(anonymous function) [as install] (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:66:37)
gyp ERR! stack at getNodeDir (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:152:20)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:95:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:722:7)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at maybeClose (child_process.js:999:16)
gyp ERR! stack at Socket.<anonymous> (child_process.js:1167:11)
gyp ERR! stack at Socket.emit (events.js:107:17)
gyp ERR! stack at Pipe.close (net.js:461:12)
gyp ERR! System Linux 3.13.0-36-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/harp/node_modules/terraform/node_modules/node-sass
gyp ERR! node -v v0.13.0-pre
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
Build failed
npm ERR! node-sass#0.9.3 install: `node build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#0.9.3 install script.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-36-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "harp"
npm ERR! cwd /home/colin
npm ERR! node -v v0.13.0-pre
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/colin/npm-debug.log
npm ERR! not ok code 0
Note that the error states that my node version is still v0.13.0-pre even though I switched to 0.10.32 with nvm.
Question is 3 years old, yet I have recently encountered same problem on osx trying to install harp and found no solution elsewhere.
After several attempts managed to solve the problem with --unsafe-perm modifier, like follow:
sudo npm install --global --unsafe-perm harp
Install went successful and everything works, hope that helps :)

Resources