Answer the question
In order to leave comments, you need to log in
How to set environment variable in start npm script with label NODE_ENV=development and run gulp task default?
How to set environment variable in npm start script with label NODE_ENV=development and run gulp task default ?
I do so
"scripts": {
"start": "cross-env NODE_ENV=development&& gulp"
},
var gulp = require("gulp");
gulp.task('default', function() {
console.log(process.env.NODE_ENV);
});
192:xxx fast$ npm start
> [email protected]1.0.0 start /Users/xxx/Sites/xxx
> cross-env NODE_ENV=development&& gulp
[20:40:30] Using gulpfile ~/Sites/xxx/gulpfile.js
[20:40:30] Starting 'default'...
undefined
[20:40:30] Finished 'default' after 820 μs
Answer the question
In order to leave comments, you need to log in
&&
in this case it is not necessary, since with it it turns out that you first start cross-env NODE_ENV=development
, and then gulp.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question