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.
Related
Im trying to install multiple packages in different child processes. And all the packages have some common dependency(browserify in my case).
example
|
|_pkg1
| |_browserify
|
|_pkg2
| |_browserify
|
|_pkg3
| |_browserify
|
|_run.js
run.js:
var packages = ['pkg1', 'pkg2', 'pkg3'];
packages.forEach(function(pkg){
exec('npm install ./' + pkg);
});
And node run.js fails with log
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "c:\\Program Files\\nodejs\\\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i
nstall" "./pkg3"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path C:\Users\Artem\AppData\Roaming\npm-cache\acorn\0.9.0\package\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! Error: EPERM, rename 'C:\Users\Artem\AppData\Roaming\npm-cache\acorn\0.9.0\package\package.json'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, rename 'C:\Users\Artem\AppData\Roaming\npm-cache\acorn\0.9.0\package\package.json']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\Users\\Artem\\AppData\\Roaming\\npm-cache\\acorn\\0.9.0\\package\\package.json',
npm ERR! parent: 'syntax-error' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
Example: https://github.com/SakerONE/multiple-npm-install
Works fine with npm 2.9.1
Just try to upgrade your npm
npm install npm#latest -g
This seems to be a tricky bug in npm, most probably, a race condition of parallel tasks writing the same package.json.
You can use --force flag to avoid cache (but it might be slow to download all dependencies on each build). Or wait for npm team to implement a permanent fix.
Related links to watch on Github:
https://github.com/Microsoft/vso-agent-tasks/issues/323
https://github.com/npm/npm/issues/2500
https://github.com/npm/npm/issues/9696
when i run the installation process and put npm install in the command line after running some processes it gives me this :
npm ERR! safefs#3.0.6 preinstall: `node ./cyclic.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the safefs#3.0.6 preinstall script.
npm ERR! This is most likely a problem with the safefs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./cyclic.js
npm ERR! You can get their info via:
npm ERR! npm owner ls safefs
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\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\Class Talkies\Desktop\www\web-starter-kit-master
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! syscall spawn
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! not ok code 0
I also got a few errors upon installing via the npm install command, but in order to get it to go away I relaunched command prompt in administrator mode. It solved the problem easily.
Hope it helps!
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).
Attempting to install Yeoman on my mac, I first tried following command from the documentation...
npm install -g yo
Got an error:
npm ERR! Please try running this command again as root/Administrator.
I tried again with:
sudo npm install -g yo
but it fails half-way through. This is the feedback where it fails and it repeats this pattern for a lot of failed packages.
npm ERR! Error: ENOENT, lstat '/usr/local/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/glob/.travis.yml'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "yo"
npm ERR! cwd /Users/vivid
npm ERR! node -v v0.10.7
npm ERR! npm -v 1.2.21
npm ERR! path /usr/local/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/glob/.travis.yml
npm ERR! fstream_path /usr/local/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/glob/.travis.yml
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
Any thoughts?
I ran into the same problem. What fixed it for me was simply logging in as root first, using:
$ su
Next, installing Yeoman worked like a charm:
$ npm install -g yo
The big difference is the logging in as root using su, instead of sudo.
I have problem while installing PhoneGap on my Mac OS machine using:
sudo npm install -g phonegap
Error message:
npm ERR! Error: shasum check failed for /Users/MYUSER/tmp/npm-33966-l4NZ7A8D/1387281663617-0.9133979633916169/tmp.tgz
npm ERR! Expected: dee5a33ff04d7217194dc1ad1342e3a441761942
npm ERR! Actual: ab7d89ca1f31db14db047d01222dd968649cfb50
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/sha/index.js:38:8
npm ERR! at ReadStream.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/sha/index.js:85:7)
npm ERR! at ReadStream.EventEmitter.emit (events.js:120:20)
npm ERR! at _stream_readable.js:896:16
npm ERR! at process._tickCallback (node.js:599:11)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! System Darwin 13.0.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "phonegap"
npm ERR! cwd /Users/HummusawY
npm ERR! node -v v0.11.10-pre
npm ERR! npm -v 1.3.17
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/MYUSER/npm-debug.log
npm ERR! not ok code 0
Try this:
sudo npm install https://registry.npmjs.org/npm/-/npm-1.3.19.tgz
then
sudo npm install -g phonegap
The problem on my checksum was caused by https://registry.npmjs.org/npm/-/npm-1.3.19.tgz
Try this first
"npm set registry https://registry.npmjs.org/"
if failed then try to use the npm mirror:
"npm set registry http://ec2-46-137-149-160.eu-west-1.compute.amazonaws.com"
then use it normally:
npm install express
You can downgrade Node.js to version 0.10.19 to solve the issue
try: npm install https://registry.npmjs.org/npm/-/npm-1.3.21.tgz
change from "19" to 21