将参数传递给“节点"运行“npm run"时可执行 [英] Pass arguments to "node" executable when running "npm run"
问题描述
我想运行npm run build
,但是我必须像--stack-size=1500
那样增加堆栈大小,我如何将它传递给npm
?
I want to run npm run build
, but I have to increase stack size like --stack-size=1500
, how can I pass it to npm
?
通常我会运行 node --stack-size=1500 ./some-script.js --some-arg
假设我无法编辑 package.json
这不是 向 npm 脚本发送命令行参数 因为那里的答案描述了在这种情况下如何将参数传递给 some-script.js
,而不是 node
This is not duplicate of Sending command line arguments to npm script because answers there describe how to pass arguments to some-script.js
in this case, not to node
推荐答案
我问过一个关于 yarn 的类似问题.好像最方便选项是使用 NODE_OPTIONS 环境变量将参数传递给 NodeJS
I've asked a similar question about yarn. It seems that the most convenient option is to use the NODE_OPTIONS environment variable to pass arguments to NodeJS
export NODE_OPTIONS="--stack-size=1500"
npm run build
另见关于纱线的答案
这篇关于将参数传递给“节点"运行“npm run"时可执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!