Windows 10 - Failed at the #angular/cli#8.2.2 postinstall script - windows

I cannot get Angular CLI installed on a new Windows 10 machine at all.
I have cleared node cache. I have uninstalled and re-installed node via every method including chocolatey. I have edited the npmrc to change the default location of node modules... everything I can find
$ npm install #angular/cli
#angular/cli#8.2.2 postinstall C:\sandbox\ang\node_modules#angular\cli
node ./bin/postinstall/script.js
npm WARN enoent ENOENT: no such file or directory, open 'C:\sandbox\ang\package.json'
npm WARN ang No description
npm WARN ang No repository field.
npm WARN ang No README data
npm WARN ang No license field.
npm ERR! file C:\Windows\system32\cmd.exe;
npm ERR! path C:\Windows\system32\cmd.exe;
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn C:\Windows\system32\cmd.exe;
npm ERR! #angular/cli#8.2.2 postinstall: `node ./bin/postinstall/script.js`
npm ERR! spawn C:\Windows\system32\cmd.exe; ENOENT
npm ERR!
npm ERR! Failed at the #angular/cli#8.2.2 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\tblaw\AppData\Roaming\npm-cache\_logs\2019-08-16T01_04_13_709Z-debug.log

Do you have the latest node installed? I though I did, but I had separate versions installed via homebrew (which had the latest 12.10), and globally only had 6.5.
Test with node -v and force latest version with nvm install 12.0.0

Related

Getting error when running command npm install cypress --save-dev

Getting below error when running command npm install cypress --save-dev
npm ERR! path C:\Windows\system32\cmd.exe;BrowserServers\chromedriver.exe
npm ERR! errno ENOENT
npm ERR! cypress#4.12.1 postinstall: node index.js --exec install
npm ERR! spawn C:\Windows\system32\cmd.exe;BrowserServers\chromedriver.exe ENOENT
npm ERR!
npm ERR! Failed at the cypress#4.12.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\Admin\AppData\Roaming\npm-cache_logs\2020-08-07T12_33_09_219Z-debug.log
NOTE : Have run npm-init and package.json is created
node -v
v12.18.3
npm -v
6.14.6
also have set NODE_HOME Env variable
check you using Node.js 8 and above

Sails.js won't install. Windows

Sails.js will not install, but just to make sure npm is working I installed grunt
npm install -g grunt-cli and it installed correctly.
But when I run npm install -g sails I get an error.
Command prompt error:
`sails#0.11.0 preinstall C:\Users\User\AppData\Roaming\npm\node_modules\sails
node ./lib/preinstall_npmcheck.js
Sails.js Installation - Error
Unable to check your npm-version
Please reinstall npm to use Sails.js
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-
cli.js" "-g" "install" "sails"
npm ERR! node v4.0.0
npm ERR! npm v2.14.2
npm ERR! code ELIFECYCLE
npm ERR! sails#0.11.0 preinstall: node ./lib/preinstall_npmcheck.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sails#0.11.0 preinstall script 'node ./lib/preinstall_npmcheck.js'.
npm ERR! This is most likely a problem with the sails package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./lib/preinstall_npmcheck.js
npm ERR! You can get their info via:
npm ERR! npm owner ls sails
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Windows\system32\npm-debug.log`
npm-debug.log:
https://gist.github.com/anonymous/c850ac8c71e0410db020
I got the same errors.
npm -g install sails
But it worked when I ran command line as administrator.
I solved this by running npm install -g sails --ignore-scripts.
The only thing I can think of is for some reason I don't have ./lib/preinstall_npmcheck.js file and it is trying to run it, so by ignoring it I don't get the error, hence the successful install.
I still don't understand why, but I hope this helps someone.

Installing PhantomJS 2 using NPM fails on Windows

I'm trying to install PhantomJS 2 for a project that requires support for mutation observers. When I use the following command:
npm install phantomjs2 --save-dev
I get the following error:
Unexpected platform or architecture: win32 x64
npm ERR! phantomjs2#2.0.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs2#2.0.0 install script.
npm ERR! This is most likely a problem with the phantomjs2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs2
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodej
s\\node_modules\\npm\\bin\\npm-cli.js" "install" "phantomjs2" "--save-dev"
npm ERR! cwd g:\Web\GitHub\pet
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! g:\Web\GitHub\pet\npm-debug.log
npm ERR! not ok code 0
I am using 64 bit Windows 7. Is PhantomJS 2 just not supported on my platform?
Yes, that package currently doesn't support installing PhantomJS 2 on Windows. Just download it from the official page and put the exe in a directory that is in the PATH.

Unable to install Grunt through Terminal

Operating System: Mac
So I was trying to install Grunt by typing the following into my terminal (through /usr/local/bin):
npm install -g grunt-cli
But I get this as a result:
Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/grunt-cli',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/grunt-cli',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /usr/local/bin
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/lib/node_modules/grunt-cli
npm ERR! fstream_path /usr/local/lib/node_modules/grunt-cli
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/local/bin/npm-debug.log
npm ERR! not ok code 0
...and that doesn't look too happy! Can anyone help me out here?
Note: I also initially tried doing it from just my usr, without the /local/bin but that came up with errors too.
I get the same result (OSX 10.9.5). It likely doesn't matter where you're running the command from - I'd expect you'd see the exact same paths erroring out.
The problem appears to be that npm wants to put globally installed packages under /usr/local/ (per https://www.npmjs.org/doc/files/npm-folders.html, executables in /usr/local/bin and modules in /usr/local/lib/node_modules on *NIX systems, which here includes OSX). This is not writable to your user on a Mac.
Your options are probably a few:
You could installing local to your project instead of globally (omit the -g). This would mean you need to reinstall the package in other project in which you want to use it. This also means you'll need to set up your PATH when you access the project to point to any binaries (e.g., grunt) under the project (export PATH=$PATH:./node_modules/bin), which you could do with a script, but may still be annoying.
You can also likely run the install again with sudo, but there are some risks there (pointed out in https://stackoverflow.com/a/25259232/1795230).
Finally, you can change the 'prefix' (via npm config set prefix ~/npm), as presented here: https://stackoverflow.com/a/21712034/1795230. This has the downside of not being "global" for real (just global to all the projects of your user) as pointed out in comment NPM won't install any package on Mac. New, clean build. `EACCES` & other errors, but that may work out fine, depending on your situation (works for me on my local dev machine).

Mac npm erroring with ENOENT

I'm a recent convert to Mac from Windows, and currently just trying to get my tools setup.
I first installed node using homebrew, which was giving me errors (same as what I still have). I later removed node using homebrew and installed using the pkg from the node website.
I can access node in the command line and npm. The problem is when I try to install modules on the project locally I get something like:
npm install grunt-contrib
Error extracting archive { [Error: ENOENT, open '/Users/davidmckeown/dev/adt-com/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/tmp/phantomjs-1.7.0-macosx.zip']
errno: 34,
code: 'ENOENT',
path: '/Users/davidmckeown/dev/adt-com/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/tmp/phantomjs-1.7.0-macosx.zip' }
Another message just above that contains:
npm ERR! phantomjs#0.2.6 install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 8
npm ERR!
npm ERR! Failed at the phantomjs#0.2.6 install script.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.2.1
npm ERR! command "node" "/usr/local/bin/npm" "install" "grunt-contrib"
npm ERR! cwd /Users/davidmckeown/dev/adt-com
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
Any help figuring out what is causing problems here would be fantastic. This happens with other modules too, from what I can tell.
npm cache clean
or if installed under su
sudo npm cache clean
There was an issue 5 months ago with grunt qunit package - https://github.com/gruntjs/grunt-lib-phantomjs/issues/5.
Try to install this specific package:
sudo npm install grunt-contrib-qunit
The package that you installed is a bundle of many packages. The qunit package version was not updated explicitly to the latest version in this bundle, that's why clearing the npm cache might solve this issue.

Resources