nodejs tips
javascript bootstrap nodejs
Manage dependency updates in your Node.js project
- If you want to see what packages are in the folder, you can enter
npm list
. You can list packages at different depths. When you do so, the list command looks like this one:npm list --depth=<depth>
npm install <name of dependency>
eg: npm install jestnpm update <name of dependency>
You can either install the latest version by runningnpm install <name of package>@<known latest version>
or use the latest keyword:npm install <name of package>@latest
.npm outdated
(find and update outdated packages) It provides information in the Wanted, Latest, and Location columns. Runnpm update <optional package name>
. If you run this command with a package name specified, the command will try to update only the specified package. If you don’t specify a package, the command will try to update all the packages in package.json.- If you have any high-level vulnerabilities, you should update the package. To fix an issue and apply an update, you can run
npm audit