【发布时间】:2020-11-03 16:29:07
【问题描述】:
package.json
"scripts": {
"start": "node app.js",
"test": "NODE_ENV=test mocha --reporter spec"
},
npm run test
if (process.env.NODE_ENV === "test") {
console.log("BLAH BLAH")
}
npm run start
if (process.env.NODE_ENV === "test") {
// does this run?
}
NODE_ENV 会是什么?如果我运行 npm run test 并在运行时将 NODE_ENV 设置为 test。什么我停止该过程然后运行 npm run start ? NODE_ENV 是否仍会从上一个命令中设置为 test?
【问题讨论】:
标签: javascript node.js package