NPM is a package management tool that is installed with Nodejs to resolve many issues with NODEJS code deployment.
Here are a few common usage scenarios:
- Allows users to download third-party packages written by others from the NPM server for local use.
- Allows users to download and install command-line programs written by others from the NPM server for local use.
- Allows users to upload their own packages or command-line programs to the NPM server for others to use.
NPM is installed in conjunction with node. js. So you can view the current NPM version number directly from the command line via the npm - v command.
NPM upgrades are available through NPM commands.
npm Install npm-g ( only for window environments )
NPM is primarily used to install a third-party package ( both module ) command:npm Install module Name.
Modules can be installed locally and can be installed to the Global. ( Install command installed to local by default )
// Local Installation // Global Installation
References to new modules after they are installed:
var new_module = require (' module_name ');
Error that may occur:
NPM err! Error:connect econnrefused 127.0.0.1:8087
Workaround:
NPM config set proxy null ( command Line input )
**************************************************************************************************************
Global Installation
- Place the installation package under/usr/local or your node's installation directory.
- Can be used directly on the command line.
Local Installation
- Place the installation package under./node_modules (the directory where the NPM command is running), and if there is no Node_modules directory, the Node_modules directory is generated under the directory where the NPM command is currently executing.
- Locally installed packages can be introduced via require ().
**************************************************************************************************************
Uninstalling the module
NPM Uninstall Module Name
Update module
NPM Update Module Name
Search Module
NPM Search Module Name
For more in-depth knowledge of NPM or the ability to create a module, click to enter
Nodejs Study Notes < five >NPM use