Laravel-mix: NODE_ENV Error

Created on 20 Jun 2017  路  5Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: #.#.# (npm list --depth=0)
  • Node Version (node -v): 6.11
  • NPM Version (npm -v): 4.6
  • OS: Windows 10

Description:

Error on npm run dev:

John Doe [2:42 PM] 
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev" "--scripts-prepend-node-path=auto"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ dev script 'NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs 
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls 
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\j.doe\IdeaProjects\proj\frontend\src\main\resources\npm-debug.log

I think there's a problem on WIndows with NODE_ENV

Steps To Reproduce:

npm run dev

Most helpful comment

It works after adding cross-env before each NODE_ENV on the scripts.

All 5 comments

Can you do npm install cross-env and update your npm script?

Yes it works with global cross-env, but without is a problem on windows.

It still doesn't work with global cross-env installed.

It works after adding cross-env before each NODE_ENV on the scripts.

Many thanks @crx4 , it's woking for my case :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hasnatbabur picture hasnatbabur  路  3Comments

Cheddam picture Cheddam  路  3Comments

amin101 picture amin101  路  3Comments

Micaso picture Micaso  路  3Comments

Bomavi picture Bomavi  路  3Comments