How do you update npm packages to new versions?
Experience Level: Junior
Tags: npm
Answer
To update the npm packages open a command-line, go to your project folder that contains a file package.json and run the following command:
npm update
To update some module to the latest major version, use the following command:
npm install <package-name>@latest
Related npm job interview questions
Should you store node_modules directory to a version control?
npm JuniorHow do you install npm?
npm JuniorUsing npm, how can you install multiple modules at once locally?
npm JuniorUsing npm, how can you display a list of all installed global packages?
npm JuniorWhat does npm audit fix command do and when would you use it?
npm Junior