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
the commands 'npm install' gives me the following error:
> nodemon#1.18.9 postinstall C:\Users\Nikhil\Music\tab-tracker\server\node_modules\nodemon
> node bin/postinstall || exit 0
npm WARN server#1.0.0 No description
npm WARN server#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (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 ERR! file bashcls
npm ERR! path bashcls
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn bashcls
npm ERR! nodemon#1.18.9 postinstall: `node bin/postinstall || exit 0`
npm ERR! spawn bashcls ENOENT
npm ERR!
npm ERR! Failed at the nodemon#1.18.9 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\Nikhil\AppData\Roaming\npm-cache\_logs\2018-12-16T19_09_40_364Z-debug.log
As can be seen from the error messages, npm install fails at nodemon#1.18.9 postinstall script.
I've tried things like, deleting the node_modules folder and re-running the 'npm install' command again, the same error appears.
Also, i tried cleaning the npm cache as suggested by this answer, and it didn't work. Trying to separtely install nodemon gives the same error as above.
I have the same problem while I installing
nodemon
in devDependencies for my existing projects in different computer.
I do a research and found a solution that helped me to solved this kind for problem. It's happening because of security issues depending on your OS.
Solve this by :
npm install -g nodemon --unsafe-perm=true --allow-root
PS :
This too can happen in Electron also, so u can solve by -
npm install -g electron --unsafe-perm=true --allow-root
I try to install Angular CLI on mac with following command
sudo npm install -g #angular/cli
The error shown as follows
/usr/local/bin/ng -> /usr/local/lib/node_modules/#angular/cli/bin/ng
> fsevents#1.2.4 install /usr/local/lib/node_modules/#angular/cli/node_modules/fsevents
> node install
sh: node: command not found
> #angular/cli#6.0.8 postinstall /usr/local/lib/node_modules/#angular/cli
> node ./bin/ng-update-message.js
sh: node: command not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/#angular/cli/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! #angular/cli#6.0.8 postinstall: `node ./bin/ng-update-message.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the #angular/cli#6.0.8 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! /Users/sugunan/.npm/_logs/2018-07-08T01_27_53_465Z-debug.log
How to fix the issue?
Following command worked
sudo npm install -g #angular/cli --unsafe-perm=true --allow-root
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
I want to install Ionic on xUbuntu.
When I execute sudo npm install -g ionic, I get the following output but have no idea what the issue is.
npm WARN package.json eyes#0.1.8 No repository field.
npm WARN package.json faye-websocket#0.4.4 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json indexof#0.0.1 No repository field.
/usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic
> node-sass#3.4.2 install /usr/local/lib/node_modules/ionic/node_modules/node-sass
> node scripts/install.js
sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! node-sass#3.4.2 install: `node scripts/install.js`
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the node-sass#3.4.2 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 scripts/install.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 4.2.0-27-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "ionic"
npm ERR! cwd /home/sisko
npm ERR! node -v v0.10.25
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/sisko/npm-debug.log
npm ERR! not ok code 0
sh: 1: node: not found
This seems to be the cause of the error.
You probably just need to install the legacy nodejs package:
sudo apt-get install nodejs-legacy
for more info see Cannot install packages using node package manager in Ubuntu
Another alternative is to use nvm https://github.com/creationix/nvm#installation , which lets you switch between different versions of node
nvm install node --reinstall-packages-from=node
nvm alias default node