I have a node package. When I run npm install
from the package root, it installs a bunch of things, but then prints several error messages that look like this:
npm WARN unmet dependency /Users/seanmackesey/google_drive/code/explore/generator/node_modules/findup-sync/node_modules/glob requires graceful-fs@'~1.2.0' but will load
I must be confused about what exactly npm install
does. If it detects a dependency, shouldn't it install it? Under what conditions does it give me error messages like this, and how can I resolve the dependencies?
This solved it for me:
package.json
, according to the errors;node_modules
(rm -rf node_modules
);npm install
.Repeat these steps until there are no more errors.
I encountered this problem when I was installing react packages and this worked for me:
npm install --save <package causing this error>
I was trying to work on an automated deployment system that runs
npm install
, so a lot of these solutions wouldn't work for me in an automated fasion. I wasn't in a position to go deleting/re-creatingnode_modules/
nor could I easily change Node.js versions.So I ended up running
npm shrinkwrap
- adding thenpm-shrinkwrap.json
file to my deployment bundle, and running installs from there. That fixed the problem for me; with the shrinkwrap file as a 'helper', npm seemed to be able to find the right packages and get them installed for me. (Shrinkwrap has other features as well, but this was what I needed it for in this particular case).In my case, the update of npm solved it.
I fixed the issue by using these command lines
$ rm -rf node_modules/
$ sudo npm update -g npm
$ npm install
It's done!
The above answers didn't help me fully even after deleteting
node_modules
directory.Below command helped me finally:
Note that this pulls node modules over an insecure HTTP connection.
Src: https://stackoverflow.com/a/13119867/4082503