全局安装webpack npm i -g webpack --registry=https://registry.npm.taobao.org
配置环境变量
假如webpack.cmd路径是C:\Users\xiaopeng\AppData\Roaming\npm\webpack.cmd
需要把C:\Users\xiaopeng\AppData\Roaming\npm配置在window环境变量里
C:\Users\xiaopeng>npm i -g webpack --registry=https://registry.npm.taobao.org
C:\Users\xiaopeng\AppData\Roaming\npm\webpack -> C:\Users\xiaopeng\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\webpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ webpack@4.28.4
added 321 packages from 278 contributors in 9.279s
C:\Users\xiaopeng>webpack -v
4.28.4