kanitw
kanitw

Reputation: 892

Cannot run npm install browserify

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 [email protected] 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)

Upvotes: 5

Views: 3152

Answers (6)

Konkret
Konkret

Reputation: 1021

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?

Upvotes: 0

Daniel Perez Alvarez
Daniel Perez Alvarez

Reputation: 6946

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:

  1. Delete the existing node_modules folder
  2. npm install [email protected] --save-peer
  3. npm install browserify

Upvotes: 2

kharhys
kharhys

Reputation: 21

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

Upvotes: 2

Houman
Houman

Reputation: 66320

In order to make the workaround work, you have to

  1. Delete the existing node_modules folder.
  2. npm install [email protected] --save-peer
  3. npm install browserify

That works guaranteed.

Upvotes: 3

kanitw
kanitw

Reputation: 892

Recently found this issue on browserify's github.

https://github.com/substack/node-browserify/issues/1049

There is a workaround described.

Upvotes: 1

Alex Baulch
Alex Baulch

Reputation: 751

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 [email protected] as a peer-dependency in your own project (npm install [email protected] --save-peer) that makes sure the [email protected] is used rather than the more recent version.

Hope that helps!

Upvotes: 0

Related Questions