Answer the question
In order to leave comments, you need to log in
What is the correct way to configure npm start script with NODE_ENV=development tag?
Good afternoon.
How can I properly configure the npm start script so that it says NODE_ENV=development?
Tried to do so. Outputs an error. "start": "NODE_ENV=development node app.js"
Tried to do it like this:
"start": "SET NODE_ENV=development && nodemon app.js"
var winston = require('winston'),
ENV = process.env.NODE_ENV; // app.get('env');
console.log(ENV); //development
function getLogger(module) {
var path = module.filename.split('/').slice(-2).join('/');
return new winston.Logger({
transports: [
new winston.transports.Console({
colorize: true,
level: (ENV == 'development') ? 'debug' : 'error',
label: path
})
]
});
}
module.exports = getLogger;
http.createServer(app).listen(app.get('port'), function() {
log.info('Express server listening on port ' + app.get('port'));
});
Answer the question
In order to leave comments, you need to log in
I will add that if you need cross-platform, then use the cross-env package, something like this:cross-env NODE_ENV=production nodemon app.js
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question