1. Installation of node in the underlying environment
Node website: https://nodejs.org
NPM doesn’t need to be installed by itself; Node comes with NPM
Enter Node-v and NPM-V in CMD to see the versions of Node and NPM
2. Configure node’s environment variables
If you install node using the default installation address, you do not need to configure the environment variable
. If you change the default address when installing node, you will need to configure the environment variable
My installation address is the NodeJS file on disk F
“F:\nodejs\node_global”
NPM config set “F:\nodejs\node_global”
NPM config set cache “F:\nodejs\node_cache”
“F:\nodejs\node_cache”
Next, configure the environment variable
and create a new variable in the system variable
variable name: NODE_PATH
variable value: F:\nodejs\node_global\node_modules create a new variable in the path of the system variable enter
%NODE_PATH% open path in the user variable create a new variable F:\nodejs\node_global
if there are other variable statements in the path related to node or NPM, especially under C, If new files are generated in the node_cache and node_global folders, then the node environment is configured successfully
3. Install global WebPack
The NPM install webpack-g statement we just used to test node’s environment variables is the global installation statement for webpack, so we have already installed the global webpack
. Since I reported almost every error I could when installing webpack, just in case, let’s install it again!
Then we install
in CMD to execute NPM install — global webpack using the installation statement provided on wabpack’s official website
Since it is installed in NPM, so the installation speed is a little slow, the left ellipsis is the progress bar, we try to install in a good network environment, otherwise it will get stuck to your despair
Once installed, execute Webpack-V in CMD if the version number appears to indicate a successful installation.