5

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)

kanitw
  • 874
  • 10
  • 19

6 Answers6

3

In order to make the workaround work, you have to

  1. Delete the existing node_modules folder.
  2. npm install miller-rabin@1.1.1 --save-peer
  3. npm install browserify

That works guaranteed.

Houman
  • 64,245
  • 87
  • 278
  • 460
2

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 miller-rabin@1.1.1 --save-peer
  3. npm install browserify
Daniel Perez Alvarez
  • 6,570
  • 5
  • 28
  • 27
2

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

kharhys
  • 21
  • 3
1

Recently found this issue on browserify's github.

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

There is a workaround described.

kanitw
  • 874
  • 10
  • 19
0

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!

Alex Baulch
  • 751
  • 1
  • 11
  • 24
0

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?

Konkret
  • 991
  • 9
  • 14