Curious what is the difference between the two procedures:
npm install xyzpackage.json, adding required module names like this:"dependencies": {
"express": "~3.4.4",
"mongodb": "*",
"body-parser": "*",
"bson": "*"
},
and then npm update
Basically package.json stores the dependencies of you application. Everything under "dependencies" is updated when you do npm update .
"bson": "*" means that it will update to latest version of module bson.
When you do npm install xyz you are basically installing xyz without telling package.json. Next time you do npm update npm will update everything under dependencies but not xyz
Here are the commands that will help you :
npm install xyz This will install xyz without telling package.json.npm install --save xyz This will install xyz and also update package.json, so that when next time you do npm update it will update xyz as well.npm install This will install everything under dependencies in package.json.npm update This will update everything under dependencies in package.json.If you just do npm install package, it doesn't add it to your package.json. Then, if you want to npm update or publish your package, it won't have all of the required packages.
You can also do npm install --save package, which will install and add to your package.json. (see the docs)
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