Are there simple or subtle reasons that package.json
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 package.json
is:
{ "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.
As of [email protected] , the npm update will change package. json to save the new version as the minimum required dependency. To get the old behavior, use npm update --no-save .
Yes and no! If the packages have already been installed into the node_modules folder, then npm install won't update any packages. If the packages haven't been installed and a package-lock. json file exists, then npm install will install the exact dependency versions specified in package-lock.
To add dependencies and devDependencies to a package. json file from the command line, you can install them in the root directory of your package using the --save-prod flag for dependencies (the default behavior of npm install ) or the --save-dev flag for devDependencies.
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.
I had the -g flag there, when I removed it, it worked as expected ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With