npm install: Failed at the node-sass#3.13.1 postinstall script - node.js

I have a angular application: https://github.com/XBITSwitzerland/ngx-admin/tree/ng2-admin
And now I try to do: npm install
But I get this error (The compete Output of the command was way too long, so I just share here the last part):
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\github\ngx-admin\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\github\\ngx-admin\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\github\ngx-admin\node_modules\wintersmith-sassy\node_modules\node-sass
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN ngx-toastr#4.4.1 requires a peer of #angular/core#^2.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-toastr#4.4.1 requires a peer of #angular/common#^2.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#3.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\danyb\AppData\Roaming\npm-cache\_logs\2019-01-29T18_25_12_699Z-debug.log
Does someone have an Idea why this error occurs and how to solve it?

If you run into this issue, read this page: https://www.bramvandenbulcke.be/en/kb/failed-node-sass3131-postinstall-script
The solution in my case:
1) Delete the package-lock.json file
2) npm install gulp-sass --save-dev
3) npm install node-sass#latest
Version specific notes:
node-sass#3.13.1 runs only on versions of Node.js up to v7 as stated in the release notes:

I think this is happening because you're missing the node-sass module. Try the following and rerun your build script and see if this resolves your issue:
npm install node-sass#latest
Also, I see you're using fsevents on a Windows platform, just a warning this module is only supported for Native access to OS X FSEvents

I had error node-sass#3.13.1 postinstall: node scripts/build.js on npm install after this message
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/linux-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/linux-x64-72_binding.node":
HTTP error 404 Not Found
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
> core-js#2.6.9 postinstall /var/www/my/armat/www/node_modules/core-js
> node scripts/postinstall || echo "ignore"
and spent hours to find solution. I was trying to install it on laravel 5.2 that uses older versions of node and npm this helped me
$ npm install -g n
$ n 6.10.2 // selecting version you need in my case 6.10.2
$ npm install -g npm#3.10.10 // same for npm
hope this will help somebody else ^_^
#######UPDATE###########
nvm install 6.10.2
nvm use 6.10.2
npm install -g npm#3.10.10

only delete
package-lock.json
file
and do npm install again

I also received the same error
"npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#3.13.1 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#3.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above."
Solution:
I increased node-sass and gulp-sass versions to latest in package.json file, then issue got fixed.

If you scroll further up in the error output and you see something like:
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
You can fix it on windows with the following steps:
delete node_modules folder
run npm install --global windows-build-toolsin powershell as admin
reinstalling node modules or node-sass with npm install

For me, problem was with the Linux directory permissions. Even with sudo and root user I couldn't make it work.
The solution to me was to change project directory owner as follows:
sudo chown my_user:my_user -R /path/to/project

Do the following commands respectively:
rm -rf package-lock.json
npm install node-sass#latest

For Ubuntu
Delete the package-lock.json file
sudo npm install gulp-sass --save-dev
sudo npm install node-sass#latest

If you use Visual Studio run following command:
npm cache clean --force
npm config set msvs_version 2019 --global
where 2019 is the version of Visual Studio

If you are using OpenBSD, that's because you need g++. Install it using
pkg_add g++
But, it gets installed as ec++, on /usr/local/bin, so you can copy, rename, or create a symlink to it using:
ln -s /usr/local/bin/ec++ /usr/local/bin/g++
Do the npm install again and it should work

Related

Npm install on cpanel server for Vue Nuxt application is not working?

I am trying to run npm install in the cpanel terminal for a project but it gives me errors.
Firstly I enter the virtual environment in the cpanel terminal as described by cpanel when you create a node application with the interface. I write the command "source /home/mywebhotel/nodevenv/mydomain.com/10/bin/activate && cd /home/mywebhotel/mydomain.com"
Then I check that node is installed which it is.
I have already added a package.json file for my Vue/Nuxt application and I then run npm install and it gives me the following:
> fibers#4.0.3 install /home/mywebhotel/nodevenv/mydomain.com/10/lib/node_modules/fibers
> node build.js || nodejs build.js
`linux-x64-64-glibc` exists; testing
Problem with the binary; manual build incoming
make: Entering directory `/home/mywebhotel/nodevenv/mydomain.com/10/lib/node_modules/fibers/build'
CXX(target) Release/obj.target/fibers/src/fibers.o
make: execvp: g++: Permission denied
make: *** [Release/obj.target/fibers/src/fibers.o] Error 127
make: Leaving directory `/home/mywebhotel/nodevenv/mydomain.com/10/lib/node_modules/fibers/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/opt/alt/alt-nodejs10/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/lib/build.js:191:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 3.10.0-962.3.2.lve1.5.35.el7.x86_64
gyp ERR! command "/opt/alt/alt-nodejs10/root/usr/bin/node" "/opt/alt/alt-nodejs10/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /home/mywebhotel/nodevenv/mydomain.com/10/lib/node_modules/fibers
gyp ERR! node -v v10.20.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
Alpine users please run: `sudo apk add python make g++`
sh: nodejs: command not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules/watchpack-chokidar2/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#^1.2.7 (node_modules/#babel/cli/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#^1.2.7 (node_modules/nodemon/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 babel-eslint#10.1.0 requires a peer of eslint#>= 4.12.1 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! fibers#4.0.3 install: `node build.js || nodejs build.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the fibers#4.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mywebhotel/.npm/_logs/2020-07-20T14_32_17_650Z-debug.log
If I try and write sudo npm install it states: bash: sudo: command not found
I hope someone can help! :)
npm install -g node-gyp
npm install --production windows-build-tools
export npm_config_node_gyp=/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js
rm -rf node_modules(if already there)
npm install
Try the above commands and check whether it's works or not.

NPM node-sass installation fails

I am trying to install node-sass in a project, which perfectly builds and runs on my pc but on my surface I am having major issues when trying to install the packages.
Note: I have tryed reinstalling and rebuilding the project several times.
Summary of the error:
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\Max-T\Documents\Sources\StaffMangerV2\black-dashboard-pro-react-v1.0.0\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Max-T\\Documents\\Sources\\StaffMangerV2\\black-dashboard-pro-react-v1.0.0\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\Max-T\Documents\Sources\StaffMangerV2\black-dashboard-pro-react-v1.0.0\node_modules\node-sass
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.11.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.11.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Max-T\AppData\Roaming\npm-cache\_logs\2019-10-30T10_05_01_386Z-debug.log
package.json => https://hastebin.com/azetegukes.pl
too much coode so I had to paste it elsewhere.
You're using Node 12, and node-sass needs to be at least 4.12 to support that version https://github.com/sass/node-sass#node-version-support-policy
If anyone runs into this lately... the easiest fix is to replace node-sass with just sass in your dependencies. It's the more recently maintained version and I only had to change 1 line of code with how it's initialized and all of my existing code was already compatible.
There are more details at https://sass-lang.com/blog/libsass-is-deprecated under How to migrate.
try this command it works for me
sudo npm install -g --unsafe-perm node-sass
Don't use node-sass anymore
node-sass is deprecated. Instead use the new version which is sass.
You can uninstall the old and install the new one with this command
npm uninstall node-sass
npm install sass
After more than 2 hours of trying all sorts of ways (cleaning npm cache, deleting node_modules, trying to install with global switch -g, etc.) to install node-sass and failing every time, I finally changed the mirror to china and it immediately worked for me!! (I know it kinda doesn't make any sense, considering the error I was getting)
Just for reference, this was the error I was receiving before it finally worked:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.14.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.14.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\****\AppData\Roaming\npm-cache\_logs\2020-06-06T13_56_56_768Z-debug.log
My Node version: v12.18.0
node-sass version in package.json: "^4.14.0"
I changed the mirror as stated in the node-sass npm page.
npm install -g mirror-config-china --registry=http://registry.npm.taobao.org
npm install node-sass
Hope that helps.
The best option would probably be to replace node-sass lib with sass one.
But in our case I fixed that by installing nvm and setting local node version to 14.17.6
My node-sass version is 4.14.1

Installing angular-cli

angular is pretty new to me and english is not my first language so I apologize in advance.
I'm a student and I have to do an app using the MEAN platform. We never worked with any MEAN component, or javascript in college but now I have to do this project. I'm following this tutorial -> https://www.youtube.com/watch?v=wtIvu085uU0&list=PLTPtZWpWLI00vlAPQnDt8OlPwoYxuMCQo&index=4 and everything up to 45 minutes into the video worked just fine. At 45 min it says I have to install #angular/cli but I got errors the first time I did it. Then I tried to type npm install #angular/cli again and then there were no errors. It was just like it should be, like it is in the video. But, when I typed ng new client it said
ng is not recognized as an internal or external command, operable program or batch file.
I don't know what to do, I tried to install angular-cli again for few times but every time it was the same. I'm desperate.
Versions:
node --version = v6.11.3
npm --version = 3.10.10
Windows 10
Errors I get when I type "npm install #angular/cli":
npm ERR! tarball.destroy is not a function
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! github
npm WARN retry will retry, error on last attempt: Error: EBUSY: resource busy or locked, rename 'C:\Users\Loran\AppData\Local\Temp\npm-9616-ee3846a1\registry.npmjs.org\eventemitter3-\eventemitter3-1.2.0.tgz.1057597416' -> 'C:\Users\Loran\AppData\Local\Temp\npm-9616-ee3846a1\registry.npmjs.org\eventemitter3-\eventemitter3-1.2.0.tgz'
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "#angular/cli"
npm ERR! node v6.11.3
npm ERR! npm v3.10.10
npm ERR! tarball.destroy is not a function
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! github
kontakti#1.0.0 D:\Project\kontakti
`-- #angular/cli#1.4.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN kontakti#1.0.0 No description
npm WARN kontakti#1.0.0 No repository field.
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "#angular/cli"
npm ERR! node v6.11.3
npm ERR! npm v3.10.10
npm ERR! Callback called more than once.
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! github
npm ERR! Please include the following file with any support request:
npm ERR! D:\Project\kontakti\npm-debug.log
For these versions:
node --version = v6.11.3
npm --version = 3.10.10
You Should try Angular CLI 4
$npm install -g #angular/cli#1.4
To use the ng command in the terminal, you need to install Angular CLI globally.
Run this command to install : npm install -g #angular/cli.

node-gyp error when running npm install

I'm new to node and a bit out of my depth here. Experiencing this error on both Mac OS X and Centos 6. Happens in all the npm install xxx commands I've tried. Any suggestions on how to get around this error much appreciated.
Similar to npm install gives node-gyp error but I do not have spaces in my username which is what solved his issue.
npm install canvas
> canvas#1.6.6 install /home/test1/ng2-webpack-demo/node_modules/canvas
> node-gyp rebuild
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
gyp: Call to './util/has_lib.sh freetype' returned exit status 0 while in
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
(/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:215:12)
gyp ERR! System Linux 2.6.32-642.4.2.el6.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-
gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/test1/ng2-webpack-demo/node_modules/canvas
gyp ERR! node -v v6.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN #angular/animations#4.3.6 requires a peer of #angular/core#4.3.6 but
none was installed.
npm WARN #angular/material#2.0.0-beta.8 requires a peer of #angular/cdk#2.0.0-
beta.8 but none was installed.
npm WARN #angular/material#2.0.0-beta.8 requires a peer of
#angular/core#^4.0.0 but none was installed.
npm WARN #angular/material#2.0.0-beta.8 requires a peer of
#angular/common#^4.0.0 but none was installed.
npm WARN #ngtools/webpack#1.2.10 requires a peer of #angular/tsc-
wrapped#^0.5.0 but none was installed.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.2
(node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current:
{"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas#1.6.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas#1.6.6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/test1/.npm/_logs/2017-08-29T15_54_58_848Z-debug.log
This is a known canvas issue, probably caused by missing native libs.
Try this see if it helps:
sudo npm uninstall -g node-gyp
sudo npm install -g node-gyp
brew install pkg-config cairo libpng jpeg giflib
npm i canvas
Source: https://github.com/Automattic/node-canvas/issues/913#issuecomment-368042394
I've same error the reason was that I don't have clang compiler installed.
My solution to this was to install build-essential package
sudo apt-get install build-essential
I'm using Ubuntu 20.1 release

Yeoman installation is showing errors

I am unable to install yo from npm I have found these errors while running installation of yo, I have made all the paths for environment variables, but still getting error, i have also cleared the cache and re-install the nodejs , reboot my pc but still getting this error
$ npm install --global yo
npm WARN deprecated npmconf#2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
C:\Users\hp\AppData\Roaming\npm\yo -> C:\Users\hp\AppData\Roaming\npm\node_modules\yo\lib\cli.js
C:\Users\hp\AppData\Roaming\npm\yo-complete -> C:\Users\hp\AppData\Roaming\npm\node_modules\yo\lib\completion\index.js
spawn-sync#1.0.15 postinstall C:\Users\hp\AppData\Roaming\npm\node_modules\yo\node_modules\spawn-sync
node postinstall
npm#1.0.0 C:\Users\hp\AppData\Roaming\npm
`-- (empty)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn-sync#1.0.15 (node_modules\yo\node_modules\spawn-sync):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn-sync#1.0.15 postinstall: node postinstall
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status -4058
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--global" "yo"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! file ;C:\Program Files\Git\bin;C:\Program Files\Git\cmd
npm ERR! path ;C:\Program Files\Git\bin;C:\Program Files\Git\cmd
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn ;C:\Program Files\Git\bin;C:\Program Files\Git\cmd
npm ERR! spawn-sync#1.0.15 postinstall: node postinstall
npm ERR! spawn ;C:\Program Files\Git\bin;C:\Program Files\Git\cmd ENOENT
npm ERR!
npm ERR! Failed at the spawn-sync#1.0.15 postinstall script 'node postinstall'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs spawn-sync
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.
npm#1.0.0 C:\Users\hp\AppData\Roaming\npm
`-- (empty)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn-sync#1.0.15 (node_modules\yo\node_modules\spawn-sync):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn-sync#1.0.15 postinstall: node postinstall
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status -4058
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--global" "yo"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! Callback called more than once.
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\hp\npm-debug.log
npm ERR! code 1
Please tell me what is the problem with it.
Just install the latest version of nodejs and the error will get resolved.
Type the instructions in the terminal and node js will get updated:
$ sudo apt purge nodejs (for removing previous files of node js)
$ wget -qO- https://deb.nodesource.com/setup_7.x | sudo bash -(it will download latest version of node)
$ sudo apt-get install nodejs
and it is done.
Happened to me too... in recent distributions many packages install nodejs as the node.js executable, while spawn-sync attempts to call node, that is why this fails.
As a workaround, you can create a softlink from node to nodejs. Something like:
sudo ln -s `which nodejs` /usr/bin/node

Resources