NPM包在process.env

问题描述 投票:0回答:2

怎么都是这些包安装到process.env,为什么我看不到NODE_ENV在NPM脚本设置?

"start": "NODE_ENV=dev npm run build && npm run watch && npm run tslint"

enter image description here

我们高度脚本:

"scripts": {
    "start": "npm run build && npm run watch && npm run tslint",
    "build": "npm run build-ts",
    "serve": "nodemon dist/Server.js",
    "watch": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run serve\"",
    "test": "mocha --compilers ts:ts-node/register",
    "build-ts": "tsc",
    "watch-ts": "tsc -w",
    "tslint": "tslint -c tslint.json -p tsconfig.json",
    "debug": "npm run build && npm run watch-debug",
    "serve-debug": "nodemon --inspect dist/Server.js",
    "watch-debug": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run serve-debug\""
},
typescript npm typescript-typings npm-scripts
2个回答
2
投票

如何将所有这些包钻进process.env

qazxsw POI反映系统的环境变量。例如。运行process.env。更多:env

为什么我没有看到NODE_ENV设置

根据您的指令https://nodejs.org/api/process.html#process_process_env它没有坚持以任何方式的环境,但是当NODE_ENV=dev npm run build && npm run watch && npm run tslint运行将出席会议。


-1
投票

设置环境变量合适的剧本是在npm run build:这工作"serve"

© www.soinside.com 2019 - 2024. All rights reserved.