简体   繁体   中英

NODE_ENV=development doesn't work on windows 7

i am having the problem while i am trying to start a fragment in a dev-mode (npm run build). it throw an Error

module.js:471
  throw err;
  Error: Cannot find module '../../dist/assets/1.05805d01bc06f054a19d4.js'.

I've tried the solution with cross-env but i didn't worked.

Makefile contains

dev:    
    NODE_ENV=production CDN_PATH=/ $(npm_bin)/webpack
    NODE_ENV=development node server --host 0.0.0.0 --port 8080

package.json

"scripts": {
       "build": "cross-env NODE_ENV=development node server --host 0.0.0.0 --port 8080"
}

You can use cross-env module for maximum portability also in the Makefile. Just make sure you have ./node_modules/.bin in your PATH or you use a full:

./node_modules/.bin/cross-env NODE_ENV=development node server ...

Of course it will work only after npm install

Also you can find some other ways o specifically change the environment on Windows in Makefiles but since you're already using cross-env then you may as well use it.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM