I have in package.json (NOT BASH, NOT SH, NOT ZSHELL, NOT FISH).
我有package.json(不是BASH,不是SH,不是ZSHELL,不是鱼)。
So after we established the fact that this is my package.json file, let me present it to you:
因此,在我们确定这是我的package.json文件之后,让我向您呈现:
package.json
"scripts": {
"dev": "NODE_ENV=myValue myProgram"
}
I want to add more vars (e.g. MYVAR=myOtherValue
) to above file, which is my package.json file. How can I do that (adding more vars to my package.json file)?
我想在上面的文件中添加更多变量(例如MYVAR = myOtherValue),这是我的package.json文件。我该怎么做(在我的package.json文件中添加更多变量)?
Let me be clear that I do not want to read the manpage of bash or zshell, or fish, or sh. This is why I put the question in here and did not read the manpage - otherwise I would not put it here and would have read the manpage. Thank you for understanding.
让我明确一点,我不想阅读bash或zshell,fish或sh的联机帮助页。这就是为什么我把问题放在这里并且没有阅读联机帮助页 - 否则我不会把它放在这里并且会阅读联机帮助页。谢谢你的理解。
1 个解决方案
#1
2
Your script should be:
你的脚本应该是:
"dev": "NODE_ENV=myValue MYVAR=myOtherValue myProgram"
as you can multiple environments when space-separated. This stems from the common behavior from terminals like bash, where you can set multiple env variables on the fly:
因为你可以在空间分隔时使用多个环境。这源于bash等终端的常见行为,您可以在其中动态设置多个env变量:
FOO1=baz FOO2=fnord FOO3=baz env | grep FOO
FOO1=baz
FOO2=fnord
FOO3=baz
#1
2
Your script should be:
你的脚本应该是:
"dev": "NODE_ENV=myValue MYVAR=myOtherValue myProgram"
as you can multiple environments when space-separated. This stems from the common behavior from terminals like bash, where you can set multiple env variables on the fly:
因为你可以在空间分隔时使用多个环境。这源于bash等终端的常见行为,您可以在其中动态设置多个env变量:
FOO1=baz FOO2=fnord FOO3=baz env | grep FOO
FOO1=baz
FOO2=fnord
FOO3=baz