0

I added this variable in my package:

json file : "prod": "npm run clean && NODE_ENV=production  webpack -p" 

finally i had this error:

'NODE_ENV' n’est pas reconnu en tant que commande interne ou externe, un programme exécutable ou un fichier de commandes.

Aziz Arafa
  • 11
  • 1
  • You may want to display the error message in English. More people will be able to understand it to help you and it may be a recognizable common error a lot of people have. – theJuls Jul 07 '18 at 12:16
  • Are you using windows? The commands in your package.json will be executed by your shell. This command will work in bash, but probably not in windows. – Håken Lid Jul 08 '18 at 07:30
  • Possible duplicate of [How can I set NODE\_ENV=production on Windows?](https://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-on-windows) – Håken Lid Jul 08 '18 at 07:30
  • ok this the error message: 'NODE_ENV' is not recognized as an internal or external command, an executable program, or a batch file. – Aziz Arafa Jul 08 '18 at 19:53
  • i added SET in the console i haven"t errors but nothing happens in my dist folder files wasn't reloaded – Aziz Arafa Jul 08 '18 at 20:52
  • my package.json: "scripts": { "dev": " webpack-dev-server", "prod": "npm run clean && NODE_ENV=production webpack -p", "clean": "rimraf ./dist/*" }, – Aziz Arafa Jul 08 '18 at 21:35
  • my webpack config file:var isProd = process.env.NODE_ENV === 'production'; // true or false var cssDev = ['style-loader', 'css-loader', 'sass-loader']; var cssProd = ExtractTextPlugin.extract({ fallbackLoader: 'style-loader' , loader: ['css-loader','sass-loader'], publicPath: '/dist' } ) – Aziz Arafa Jul 08 '18 at 21:36

0 Answers0