报错信息
代码语言:javascript复制D:workspacegithubminiobrowser>npm run dev
> browser@0.0.1 dev D:workspacegithubminiobrowser
> NODE_ENV=dev webpack-dev-server --devtool cheap-module-eval-source-map --progress --colors --hot --content-base dev
'NODE_ENV' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR!
npm ERR! Failed at the browser@0.0.1 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:UsersadminAppDataRoamingnpm-cache_logs2020-05-20T07_17_22_879Z-debug.log
解决方法:
npm install cross-env
然后修改package.json中
代码语言:javascript复制 "scripts": {
"test": "jest",
"dev": "NODE_ENV=dev webpack-dev-server --devtool cheap-module-eval-source-map --progress --colors --hot --content-base dev",
"build": "NODE_ENV=dev node build.js",
"release": "NODE_ENV=production MINIO_UI_BUILD=RELEASE node build.js",
"format": "esformatter -i 'app/**/*.js'"
}
将dev值的NODE_ENV前面添加 cross-env,修改后为
代码语言:javascript复制 "scripts": {
"test": "jest",
"dev": "cross-env NODE_ENV=dev webpack-dev-server --devtool cheap-module-eval-source-map --progress --colors --hot --content-base dev",
"build": "NODE_ENV=dev node build.js",
"release": "NODE_ENV=production MINIO_UI_BUILD=RELEASE node build.js",
"format": "esformatter -i 'app/**/*.js'"
}
再次 npm run dev 即可。