[乐意黎原创]npm run dev 时抛'cross-env' is not recognized as an internal or external command的解决方法

通过 Vue init webpack-simple 创建工程中,  运行 npm run dev 时抛以下错误,

 cross-env NODE_ENV=development webpack-dev-server --open --hot

'cross-env' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! support-center@1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the support-center@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Aerchi\AppData\Roaming\npm-cache\_logs\2020-03-24T18_46_51_349Z-debug.log

解决方法: 

webpack打包报错,原因是windows不支持 cross-env,安装模块即可:

npm install -g  cross-env

cnpm install -g  cross-env
--------------------------------
First, run:

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force

Then run the command

npm install cross-env

npm install 

and then you can also run

npm run dev
打杂人 CSDN认证博客专家 打杂人
最近的你,是我最远的爱。
最远的你,是我最近的爱。
味无味处寻乐,材不材间度生。
习惯了不习惯,不习惯了习惯。
可怜身上衣正单,心忧炭贱愿天寒。
©️2020 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值