I have an app which is working perfectly on linux but when I execute it on windows I get this error.
'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.
SET NODE_ENV=debug
which I found here “NODE_ENV” is not recognized as an internal or external command
And here is snippet of code package.json where I guess is my mistake.
"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
. You need to adapt the NPM run tasks to use Windows' syntax:
"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.
Setup your NODE_ENV with export. So in your package.json add in your scripts block
"scripts":{
"webpack-watch": "export NODE_ENV='debug' && webpack --progress -d --colors --watch",
"server-watch": "export NODE_ENV='debug' && nodemon backend/server.js"
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.