1. The following is the specific details of the error; Node 8.1.2 Issue: Other space installation succeeded but the installation Webpack always reported the following error: Workaround for reinstalling node
2.
NPM Module Manager
From the JavaScript standard reference tutorial (Alpha), by Nanyi directory introduction NPM init npm set npm config npm info npm search NPM list NPM Install base This usage installs different versions to avoid system privileges NPM UPDATE,NPM uninstall npm run parameter Scripts script commands best practices pre-and post-scripts internal variable wildcard the NPM link npm bin npm adduse R NPM Publish NPM deprecate npm owner other commands npm home,npm repo npm outdated NPM prune npm shrinkwrap Reference link Introduction
NPM has two levels of meaning. One layer of meaning is node's Open module registration and management system, with the URL npmjs.org. Another layer of meaning is node's default module manager, which is a command-line software that installs and manages node modules.
NPM does not need to be installed separately. When you install node, NPM is installed together. However, the NPM that came with node may not be the latest version, and it is best to update to the latest version with the following command.
$ NPM Install Npm@latest-g
In the above command, @latest represents the latest version,-G indicates a global installation. So, the backbone of the command is NPM install NPM, which is the use of NPM installation itself. This is possible because NPM itself is no different from the other modules of node.
Then, run the following command to view the various information.
# View NPM command list
$ NPM Help
# See simple usage of individual commands
$ npm-l
# View NPM version
$ npm-v
# View NPM configuration
$ npm confi G List-l
NPM Init
NPM Init Initializes a new Package.json file to be generated. It will ask the user a series of questions, if you feel that you do not have to modify the default configuration, all the way to enter.
If you use-f (on behalf of force),-y (for Yes), skip the question stage and generate a new Package.json file directly.
$ NPM init-y
NPM Set
The NPM set is used to set environment variables.
$ npm Set init-author-name ' Your name '
$ npm set init-author-email ' Your email '
$ npm Set Init-author-url ' http: YourDomain.com '
$ npm set init-license ' MIT '
The above command sets the default value for NPM init, and the Package.json author name, Mail, home page, and license fields are automatically written to the preset values when the NPM init is executed. This information will be stored in the user's home directory of the ~/.NPMRC file, so that users do not have to enter each project. If a project has different settings, you can run NPM config for that project.
$ NPM Set Save-exact True
When the above command is set to add a module, Package.json will record the exact version of the module instead of an optional version range. NPM config
$ npm config set prefix $dir
The above command sets the specified $dir directory to the global installation directory of the module. If you currently have write access to this directory, then when running NPM install, you no longer need the sudo command to authorize it.
$ NPM Config Set Save-prefix ~
The above command makes NPM install--save and NPM installs--save-dev when the new module is installed, the allowed version range is changed from the carat sign (^) to the tilde (~), that is, from allowing the minor version to upgrade to only allow the patch package upgrade.
$ npm config set init.author.name $name
$ npm config set Init.author.email $email
The above command specifies the field default value of the generated Package.json file when using NPM init. NPM Info
The NPM Info command allows you to view specific information for each module. For example, view the information for the underscore module.
$ NPM Info underscore
{name: ' underscore ',
description: ' javascript\ ' s Functional Programming Helper library. ',
' Dist-tags ': {latest: ' 1.5.2 ', stable: ' 1.5.2 '},
repository:
{type: ' git ',
url: ' git://github.com/ Jashkenas/underscore.git '},
homepage: ' http://underscorejs.org ',
main: ' Underscore.js ',
version: ' 1.5.2 ',
devdependencies: {phantomjs: ' 1.9.0-1 '},
licenses:
{type: ' MIT ',
url: ' https:// Raw.github.com/jashkenas/underscore/master/license '},
files:
[' underscore.js ',
' Underscore-min.js ',
' LICENSE '],
readmefilename: ' Readme.md '}
The above command returns a JavaScript object that contains details about the underscore module. Each member of this object can be queried directly from the info command.
$ NPM Info Underscore description
JavaScript ' s Functional Programming Helper library.
$ NPM Info Underscore homepage
http://underscorejs.org
$ npm Info underscore version
1.5.2
NPM Search
The NPM Search command searches for the NPM repository, which can be followed by a string or regular expression.
$ NPM Search < search terms >
Here is an example.
$ NPM Search Node-gyp
//NAME DESCRIPTION
//Autogypi Autogypi handles dependencies for NODE-GYP Projects.
Grunt-node-gyp Run node-gyp commands from grunt.
Gyp-io Temporary solution to let Node-gyp run ' rebuild ' under ...
// ...
NPM List
The NPM List command lists all the modules that are installed for the current project, along with the modules they depend on, in a tree-type structure.
$ NPM List
Together with the global parameter, the globally installed module is listed.
$ NPM List-global
The NPM List command can also list individual modules.
$ NPM List Underscore
NPM Install
Basic Usage
The node module is installed with the NPM Install command.
Each module can be "installed globally" or "installed locally." "Global Installation" refers to the installation of a module into the system directory, which can be called by individual projects. Generally, the global installation applies only to tool modules, such as Eslint and gulp. "Local Installation" refers to downloading a module to the Node_modules subdirectory of the current project, and then only in the project directory to invoke the module.
# locally installed
npm install <package name>
# Global Install
$ sudo npm install-global <package name>
$ sudo np M install-g <package name>
NPM install also supports direct input of GitHub code base addresses.
$ NPM Install git://github.com/package/path.git
$ npm Install git://github.com/package/path.git#0.1.0
Before installation, the NPM install checks to see if the specified module already exists in the Node_modules directory. If it does exist, it is no longer reinstalled, even if the remote repository already has a new version.
If you want a module to be forced to reinstall regardless of whether it is installed or not, you can use the-f or the--force parameter.
$ NPM Install <packageName>--force
If you want all modules to be forced to reinstall, remove the Node_modules directory and re-execute the NPM install.
$ RM-RF node_modules
$ npm Install