Home  >  Article  >  Web Front-end  >  How to use npm update in node.js

How to use npm update in node.js

不言
不言Original
2018-12-29 15:45:5811392browse

npm update is an update command, which updates npm packages. npm is the package management system used in Node.js. Node.js usually runs on the command line. For this reason, we use update to update packages. We Update is also used to keep the development environment up to date.

How to use npm update in node.js

Update npm

The command to update npm itself is as follows.

npm update npm

Update packages with npm

You can use the npm command to update packages.

npm update 程序包名称
npm up 程序包名称
npm upgrade 程序包名称

Explanation:

The npm update in the first line is the npm command, which means update. With this, you can update the npm package.

Specifically, updates can be made by describing the package name to be updated in the package name section.

The npm up in the second line is the abbreviation of the update command.

The third line npm upgrade can update the npm package, which is the same as the npm update command.

In addition, you may think npm upgrade is better. However, we usually use update. If you are developing by one person, you can use either one, as long as you know it. But if you are developing in a team, the best command to use is the frequently used update.

Updating global packages in npm

Global is a directory (file) that can be used anywhere on the computer.

Command

npm update -g 程序包名称

Description:

Commands with - are optional. Setting -g means global.

Globally installed packages are available anywhere on this computer, which means that packages available anywhere on this computer can be updated using this command.

If -g is not specified, only the packages in the directory (file) of the current operation are updated.

Use npm to update multiple packages in batches

Command

npm update  需更新的包名 需更新的包名

Description: You can update multiple packages at once by listing the package names.

In addition to this update method, another method is to use npm-check-updates to immediately update the npm package and check the dependent packages.

The above is the detailed content of How to use npm update in node.js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use env in node.jsNext article:How to use env in node.js