Cannot run npm install browserify - installation

I try to run npm install browserify both locally and globally (-g)
but I always got the follow errors
npm ERR! peerinvalid The package bn.js does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer miller-rabin#1.1.2 wants bn.js#^0.16.0
npm ERR! System Darwin 14.0.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "browserify"
npm ERR! cwd /Users/kanitw/Dropbox/_Projects/_idl/_visrec/vegalite
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/kanitw/Dropbox/_Projects/_idl/_visrec/vegalite/npm-debug.log
npm ERR! not ok code 0
Not sure how to solve it.
(My node version is v0.10.24, I'm on OSX Yosemite)

In order to make the workaround work, you have to
Delete the existing node_modules folder.
npm install miller-rabin#1.1.1 --save-peer
npm install browserify
That works guaranteed.

Had the same issue on Linux. Try running npm update -g
before installing browserify. This has worked for me.

This commit introduced the breaking change: https://github.com/indutny/miller-rabin/commit/bb85f555974587a410a17173f0bc484133b53cb7
The author of the library should fix it, but meanwhile you can:
Delete the existing node_modules folder
npm install miller-rabin#1.1.1 --save-peer
npm install browserify

Recently found this issue on browserify's github.
https://github.com/substack/node-browserify/issues/1049
There is a workaround described.

There are details of a workaround list in the issues on the github page
Error listing
To summarise the solution posted in the issue, you need to install miller-rabin#1.1.1 as a peer-dependency in your own project (npm install miller-rabin#1.1.1 --save-peer) that makes sure the bn.js#0.15 is used rather than the more recent version.
Hope that helps!

Try zipping your existing node_modules and package.json, then delete them.
You may need to 1st generate a new package.json using:
npm init
Then install browserify locally:
npm install browserify
Also, you'll have to install browserify globally:
npm install browserify -g
To zip on CMD or terminal refer to the following article:
How to zip a file using cmd line?

Related

.bin/authorize-ios not found when installing appium using npm install -g appium

When I try to install appium using npm install -g appium
I get the message
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/local/lib/node_modules/appium/node_modules/.bin/authorize-ios
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/appium/node_modules/.bin/authorize-ios'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
If I run the install again I get
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/local/lib/node_modules/appium/build/lib/main.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/appium/build/lib/main.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
The first .bin/authorize-ios is indeed not there. I don't know how to fix it. When I install using npm install appium-ios-driver the driver is installed under User/node_modules and not at usr/local/lib/node_modules. I installed npm using brew.
I was able to solve this by installing the NPM 6 (6.14.9 as of this writing)
npm i -g npm#6
npm i -g appium
If you want to lock into a particular version of npm instead of latest then this should get you to a version that should install it
npm i -g npm#6.14.9
authorize-ios is deprecated. appium authorize-ios
removing appium, updating npm, cleaning the cache and re-installing appium via npm worked for us on this issue(updated 4 build agents this way successfully).
npm uninstall -g appium && npm install -g npm && npm clean cache --force && npm install -g appium
It looks like a permission issue, I suggest you try it again from scratch:
npm uninstall -g appium or just go and delete /usr/local/bin/appium
npm install -g appium#1.18.3
It also makes sense to install appium-doctor to inspect your system has everything setup properly for Appium: npm install -g appium-doctor
You can check detailed setup here
you can use appium desktop, It is very easy, just install and edit configuration(andorid sdk path and jdk path) and start server.

-bash: gulp: command not found in Mac

I try install gulp in mac like this :
Is-iMac:~ itop$ npm root
/Users/itop/node_modules
Is-iMac:~ itop$ npm config set prefix /usr/local
Is-iMac:~ itop$ npm root -g
/usr/local/lib/node_modules
Is-iMac:~ itop$ sudo npm install -g gulp
After Install I see this error In terminal:
npm WARN deprecated graceful-fs#3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs#^4.0.0 as soon as possible.
npm WARN deprecated lodash#1.0.2: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN deprecated graceful-fs#1.2.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs#^4.0.0 as soon as possible.
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "gulp"
npm ERR! node v5.6.0
npm ERR! npm v3.8.0
npm ERR! path /usr/local/bin/gulp
npm ERR! code EEXIST
npm ERR! Refusing to delete /usr/local/bin/gulp: ../lib/node_modules/gulp-cli/bin/gulp.js symlink target is not controlled by npm /usr/local
npm ERR! File exists: /usr/local/bin/gulp
npm ERR! Move it away, and try again.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/it/npm-debug.log
Now when i type gulp for start/run in terminal i see this error:
-bash: gulp: command not found
EDIT:
I try with this comment By archie-voyageur:
npm install --global gulp-cli
And See this error:
/usr/local/bin/gulp -> /usr/local/lib/node_modules/gulp-cli/bin/gulp.js
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--global" "gulp-cli"
npm ERR! node v5.6.0
npm ERR! npm v3.8.0
npm ERR! path /usr/local/share/man/man1/gulp.1
npm ERR! code EEXIST
npm ERR! Refusing to delete /usr/local/share/man/man1/gulp.1: ../../../lib/node_modules/gulp/gulp.1 symlink target is not controlled by npm /usr/local
npm ERR! File exists: /usr/local/share/man/man1/gulp.1
npm ERR! Move it away, and try again.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/itop/npm-debug.log
How do fix this?
Just came across this issue myself and managed to solve it with:
$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli
go to
cd /usr/local/bin
ls -las
if gulp is present delete that directory. (sudo rm -rf gulp) reinstall
gulp-cli
===================================================================
if it is not working uninstall node, npm completely and try again
follow this link for step by step guide
node and npm uninstall step by step
I think you have gulp installed in your system, or at least you have some files related to gulp. Just do npm uninstall --global gulp gulp-cli and then try to install it again with npm install --global gulp-cli. If this doesn't work, I don't know what is happening on your system.
After pulling my hair out trying all of these, I ended up being able to install stupid gulp by doing
npm uninstall --global gulp gulp-cli
yarn global add gulp
For me it worked only when I installed gulp using npm instead of yarn. Very weird..

Can't npm install dependencies when building docker image

I'm building an image from a Dockerfile and the part where I npm install the dependencies is erroring when I build the image, but I can run the commands outside of it. I don't know exactly where this error is coming from.
I'm using boot2docker on Windows and my Dockerfile is:
FROM ubuntu:15.04
RUN apt-get -y update
RUN apt-get -y install nodejs
RUN apt-get -y install npm
COPY /server /src
COPY /server/package.json /tmp/package.json
RUN cd /tmp && npm install
(etc)
The error message is:
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! sails#0.11.0 preinstall: 'node ./lib/preinstall_npmcheck.js'
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the sails#0.11.0 preinstall script.
npm ERR! This is most likely a problem iwth 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 additional logging output above.
npm ERR! System Linux 4.0.3-boot2docker
npm ERR! command "usr/bin/nodejs" "/usr/bin/npm" "install"
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! /tmp/npm-debug.log
npm ERR! not ok code 0
INFO[0633] THe command [/bin/sh -c cd /tmp && install] returned a non-zero code: 1
Although it says it's probably a problem with Sails, I have no problem installing it on my machine. I can't install it when I run the image (obviously), and when I try to just run the ubuntu:15.04 image and install npm and Sails there, it tells me that npm is a command not found.
I'm still new to Docker (and to Windows-- I can't even find the npm-debug.log) so any type of advice helps a lot.
Thank you!
It's a problem of nodejs installation which was covered here: what are the differences between node.js and node?
Breifly, there are three options to fix this: creating symlink yourself, using nvm, or installing nodejs-legacy instead of nodejs:
RUN apt-get -y install nodejs-legacy

NPM install fails

I am currently unable to install NPM on Mac OS, I have looked all over the place for someone with the same error, but I can't seem to find any. Could anyone give me a hand? This is what I get after running the curl command to install NPM:
All clean!
npm-install-94139.sh: line 302: 94407 Segmentation fault: 11 "$node" cli.js rm npm -gf
npm ERR! addLocal Could not install .
npm ERR! Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock'
npm ERR! { [Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.5.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package
npm ERR! node -v v0.8.19
npm ERR! npm -v 1.1.71
npm ERR! path /Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package/npm-debug.log
npm ERR! not ok code 0
It failed
The solution on this other question seems better than messing around with NVM - npm throws error without sudo
SOLUTION:
You need to unlock permissions in home directory, like Noah says.
sudo chown -R `whoami` ~/.npm
You also need to write it to your library as well, like Xilo says.
sudo chown -R `whoami` /usr/local/lib/node_modules
My guess is that a directory used by npm (maybe /usr/local or something in your home folder) has the wrong permissions. Installing with sudo might work now but it can also bite you later since you'll definitely create files and directories as root, possibly causing problems later when npm tries to cache things.
My advice would be to uninstall, then reinstall via nvm instead. This does a great job of managing different node versions under ~/.nvm without having to use sudo.
Try clearing npm cache with
npm cache clean
Hope that helps.
when all else fails, clear you cache
Did you try "sudo" with your curl command?
Also, if you install a new version of Node, it now includes NPM, so you don't have to even install NPM separately..
From the NPM readme file: https://npmjs.org/doc/README.html
SUPER EASY INSTALL
npm comes with node now.
Windows Computers
Get the MSI. npm is in it.
Apple Macintosh Computers
Get the pkg. npm is in it.
Other Sorts of Unices
Run make install. npm will be installed with
node.
If you want a more fancy pants install (a different version, customized paths, etc.) then read on...

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