Brian Muenzenmeyer Brian Muenzenmeyer - 1 year ago 188
Node.js Question

npm install packagename --save-dev not updating package.json

Are there simple or subtle reasons that

would not update after running a --save-dev? This is my command:

npm install modulename --save-dev

Run from the root of the project. The command succeeds, the new module shows up in the node_modules directory as expected. Help would be appreciated. I am using npm v 1.4.28

The entirety of my current

"name": "FooWeb",
"version": "1.0.0",
"description": "Foo Web",
"devDependencies": {
"gulp": "3.8.11",
"gulp-jshint": "1.9.2",
"gulp-concat": "2.5.2",
"gulp-sass": "1.3.3",
"gulp-sourcemaps": "1.4.0",
"gulp-watch": "4.1.1"

I do get warnings on install of a package that I have no repository field or README, but I think that is not related.

Answer Source

I had this problem as well, and it was driving me crazy.

What finally fixed it was running npm init. This added a bunch of stuff to my package.json, but afterwards --save-dev worked as expected. Even after I removed all the new stuff added by npm init, --save-dev still worked.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download