3

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?

Normally I'd run node --stack-size=1500 ./some-script.js --some-arg

Let's say I can't edit package.json

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

Community
  • 1
  • 1
ma2s
  • 1,312
  • 1
  • 11
  • 24
  • 1
    I'm afraid that there is no way to do it if you can't edit package.json. While editing package.json is possible, see answer of http://stackoverflow.com/questions/35221098/passing-arguments-to-npm-script-in-package-json – aleung Oct 22 '16 at 04:47

1 Answers1

5

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

see also the answer about yarn

dre-hh
  • 7,840
  • 2
  • 33
  • 44
  • 2
    `$ NODE_OPTIONS="--stack-size=2000" node` results in `node: --stack-size= is not allowed in NODE_OPTIONS` for node 10.18.1 The same for `--stack_size`. – Piotr Dobrogost May 22 '20 at 14:06