1

Whenever I try to import a project in node.js, I can't seem to get it to work. It gives error's when I try to install. I've tried using cmd, cmd as admin, cmd for node and git bash. They all give the same error and I can't seem to figure out what it means.

This is an example of the output I get when i use "npm install express -g"

c:\wamp\www\3imda\webtech2\eindopdracht>npm install express -g npm WARN unmet dependency C:\Users\Maïteh\AppData\Roaming\npm\node_modules\phone gap\node_modules\phonegap-build requires colors@'0.6.x' but will load npm WARN unmet dependency C:\Users\Maïteh\AppData\Roaming\npm\node_modules\phone gap\node_modules\colors, npm WARN unmet dependency which is version 0.6.0-1 npm WARN unmet dependency C:\Users\Maïteh\AppData\Roaming\npm\node_modules\phone gap\node_modules\prompt\node_modules\winston requires colors@'0.x.x' but will lo ad npm WARN unmet dependency C:\Users\Maïteh\AppData\Roaming\npm\node_modules\phone gap\node_modules\colors, npm WARN unmet dependency which is version 0.6.0-1 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" "install" "express" "-g" npm ERR! node v0.12.0 npm ERR! npm v2.5.1 npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package mongoose does not satisfy its siblings' peerDep endencies requirements! npm ERR! peerinvalid Peer node-restful@0.1.18 wants mongoose@~3

npm ERR! Please include the following file with any support request: npm ERR! c:\wamp\www\3imda\webtech2\eindopdracht\npm-debug.log

c:\wamp\www\3imda\webtech2\eindopdracht>

I get the same error when i try "npm install -g"

M M
  • 87
  • 2
  • 12
  • Looks like there's a dependency issue. What does your `package.json` file look like? – Brennan Apr 10 '15 at 19:46
  • this is the package.json file's content http://gyazo.com/d74d4ac47eeb4c0684a5869346ae4a95 – M M Apr 10 '15 at 21:33
  • Thanks, I'll see if I can reproduce this. In the meantime, you might try installing without the `-g` flag. [Here's when you should use it](http://stackoverflow.com/questions/8909986/when-should-i-use-npm-with-g-flag-and-why). If that doesn't work, could you also upload the `npm-debug.log` to see if there is any more information we can use in there? Thanks! – Brennan Apr 10 '15 at 21:55
  • Thank you very much for your help. When i leave the "-g" the express installs but when i use "npm install", whitch should install alle the modules ? it stil gives an error http://gyazo.com/5e44f057ec6e807ecc91f05018eca9e4 Where can I upload the debug log? – M M Apr 10 '15 at 22:02
  • No need, that screenshot was exactly what I needed. Check out my answer and let me know that this solved your issue. – Brennan Apr 10 '15 at 22:12
  • http://stackoverflow.com/questions/41821698/npm-install-error-issue – Pooja Kedar Mar 22 '17 at 08:49

1 Answers1

2

From this screenshot, you can see that node-restful expects a mongoose of version ~3, but from this screenshot, you can see that you have version 4.0.1 of mongoose! The immediate solution is to change the version of mongoose in the package.json file to 3.9.7 and re-run npm install (without the -g). This is what worked for me locally.

You can read more about Peer Dependencies, should you like to know why this was happening.

Cheers, Brennan

Brennan
  • 1,764
  • 1
  • 14
  • 17
  • Yess it worked !! Thank you soo much !! Will this change give problems for my co-worker when I push it to git ? – M M Apr 10 '15 at 22:16
  • Glad I could help. It shouldn't give them issues. It's likely they just haven't run `npm install` in a while and if they were to try it, they would see the same issue. If you feel this solved your question, please accept my answer! I'm here if you have any follow up questions though. – Brennan Apr 10 '15 at 22:19
  • oh, looks like I still can't run the app :s. And nodemon must be installed with "-g" ? But then I still get an error – M M Apr 10 '15 at 22:23
  • Nodemon is one of the ones that must be installed with -g. What if you run `npm install -g nodemon`? – Brennan Apr 10 '15 at 22:24
  • It's possible that there's some issues from installing some of these `node_modules` in the global context. Try running `npm uninstall -g mongoose` and `npm uninstall -g node-restful`, then try installing nodemon with `npm install -g nodemon` – Brennan Apr 10 '15 at 22:29
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/74976/discussion-between-brennan-and-user3632443). – Brennan Apr 10 '15 at 22:31