npm in the node environment is the default package management and distribution tool; the full name of npm is "Node Package Manager", which has become an unofficial standard for publishing node modules. npm allows users to download others from the NPM server Write third-party packages for local use, or allow users to upload their own packages or command line programs to the NPM server for others to use.
The operating environment of this article: Windows 10 system, nodejs version 16, Dell G3 computer.
npm is the default package manager for the JavaScript runtime environment Node.js.
NPM’s full name is Node Package Manager, which is a NodeJS package management and distribution tool that has become an unofficial standard for publishing Node modules (packages).
npm is a package management tool installed along with Nodejs. It can solve many problems in Nodejs code deployment. Common usage scenarios include the following:
Allow users Download third-party packages written by others from the NPM server and use them locally.
Allows users to download and install command line programs written by others from the NPM server for local use.
Allows users to upload packages or command line programs they write to the NPM server for others to use.
Since the new version of nodejs has integrated npm, npm has also been installed before. You can also test whether the installation is successful by entering "npm -v". The command is as follows. If the version prompt appears, it means the installation is successful:
$ npm -v 2.3.0
If you are installing an old version of npm, you can easily upgrade it through the npm command. The command is as follows:
$ sudo npm install npm -g /usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js npm@2.14.2 /usr/local/lib/node_modules/npm
If it is Window The system can use the following command: npm install npm -g
Global installation and local installation
npm package installation is divided into local installation (local) and global installation (global) ). Judging from the command line, the difference is only whether there is -g. For example,
npm install express # 本地安装 npm install express -g # 全局安装
If the following error occurs: npm err! Error: connect ECONNREFUSED 127.0.0.1:8087
The solution is: $ npm config set proxy null
Local installation
Global installation
nodejs video tutorial"
The above is the detailed content of What is npm in node environment. For more information, please follow other related articles on the PHP Chinese website!