webpack is not an internal command issue

I encountered this problem while helping others install webpack! ! I haven't encountered it myself. . A little panicked 
on the Internet, it seems that no one has encountered such a problem. I saw a post that although the error was different from mine, he mentioned that it was because of the setting of environment variables, and then I suddenly realized! ! This should also be a problem with environment variables! So Baidu found a useful article with the keyword "installing webpack and modifying environment variables". http://www.cnblogs.com/ChengWuyi/p/5020160.html 
But he didn't explain one step clearly, so I decided to rewrite the solution.

To install webpack, first check whether you have npm (which comes with nodejs), enter npm on the command line, and see the version number to indicate that the installation is successful: 
write picture description here

Then try to install it according to the online webpack tutorial (available on Huizhi.com). After installation, follow the tutorial to check whether the installation is complete. If there is an error that is not an internal command, you can try the solution:

1. Enter the path command on the command line to see if nodejs is installed successfully (this step is written in the blog post I mentioned above);

2. Then configure the npm path and 
configure the global path: npm config set prefix "d:\nodejs\node_global" 
Configure the cache path: npm config set cache "d:\nodejs\node_cache"

3. Install webpack globally through npm, enter the command npm install webpack -g, and the installation path will be displayed after installation;

4. Modify the environment variable: add the NODE_PATH variable to the system variable (the picture comes from the blog post mentioned above) 
write picture description here

Then add the same path to the PATH variable (PS: the paths here are related to the paths configured in step 2);

5. (The picture comes from the blog post mentioned above) 
write picture description here

That's it! ! Finally got the project up and running! ! I feel like going to heaven~~~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326023332&siteId=291194637