Friday 6 December 2019

NPM update package

https://bytearcher.com/articles/using-npm-update-and-npm-outdated-to-update-dependencies/

Going for bigger update with @latest tag

Updating a version that is beyond semantic versioning range requires two parts. First, you ask npm to list which packages have newer versions available using npm outdated.
1 $ npm outdated
2 Package  Current  Wanted  Latest  Location
3 lodash    3.10.1  3.10.1  4.16.4  backend
Then you ask npm to install the latest version of a package. You can ask for the latest version with the @latest tag. You should also use the --save flag to update package.json.
1 $ npm install lodash@latest --save
Now npm installs version 4.16.4 under node_modules. Also, package.json is updated.
1 "dependencies": {
2     "lodash": "^4.16.4"
3 }

No comments:

Post a Comment