[英]'NODE_ENV' is not recognized as an internal or external command
I have an app which is working perfectly on linux but when I execute it on windows I get this error. 我有一个可以在Linux上完美运行的应用程序,但是当我在Windows上执行该应用程序时,出现此错误。
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
'NODE_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! aaa@1.0.0 webpack-watch: `NODE_ENV='debug' webpack --progress -d -colors --watch`
npm ERR! Exit status 1
npm ERR!
I have tried this in cmd. 我已经在cmd中尝试过了。
SET NODE_ENV=debug
which I found here “NODE_ENV” is not recognized as an internal or external command 我在这里找到的“ NODE_ENV”未被识别为内部或外部命令
And here is snippet of code package.json where I guess is my mistake. 这是代码package.json的代码段,我想这是我的错误。
"webpack-watch": "NODE_ENV='debug' webpack --progress -d --colors --watch",
"server-watch": "NODE_ENV='debug' nodemon backend/server.js"
Windows doesn't understand the syntax var=value cmd1 arg1
. Windows无法理解语法
var=value cmd1 arg1
。 You need to adapt the NPM run tasks to use Windows' syntax: 您需要调整NPM运行任务以使用Windows的语法:
"webpack-watch-win": "set NODE_ENV=debug & webpack ..."
"server-watch-win": "set NODE_ENV=debug & nodemon ..."
....but there are probably more errors you will hit downstream. ....但是您可能会在下游遇到更多错误。 This should at least get you past the environment variable declaration, though.
但是,这至少应该使您摆脱了环境变量声明。 Node is strongly rooted in *nix shells, not cmd.exe.
节点牢固地植根于* nix外壳,而不是cmd.exe。
Setup your NODE_ENV with export. 通过导出设置您的NODE_ENV。 So in your package.json add in your scripts block
所以在你的package.json中添加你的脚本块
"scripts":{
"webpack-watch": "export NODE_ENV='debug' && webpack --progress -d --colors --watch",
"server-watch": "export NODE_ENV='debug' && nodemon backend/server.js"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.