After npm run dev an error was reported cross-env BABEL_ENV-developent webpack-dev-server solution

Error messageInsert picture description here

problem causes:

Because when installing dependencies before, some dependencies were not installed by -g, so the dependencies exist in the current folder.
When you change folders, these dependencies will not be used.
-g is installed globally, so regardless of the folder Can be used everywhere

Solutions:

First, you need -g when installing, because webpack-dev-server is global.

Say "cross-env NODE_ENV=demo webpack-dev-server --open --config" this sentence. It can also be seen from cross-env that webpack-dev-server is global, because cross-env is compatible with windows. cross-env can also be deleted, it doesn't matter. The following "–open --config" are all parameters, as long as they start with "–", they are all parameters. So the main problem is webpack-dev-server.

Specific operation process:

1. node_modules deleted items folder in the folder
2.npm I
3.npm RUN dev (at this time being given)
4.sudo NPM-I WebPACK dev -g-Server
5. The password

The above operation process was checked out by Baidu. I executed this process to the third step and the npm run dev page came out~
It is estimated that it is a version problem

Reprinted at: https://www.cnblogs.com/sherrycat/p/11230608.html

Guess you like

Origin blog.csdn.net/weixin_45811256/article/details/112804404