Context
To iterate on https://stackoverflow.com/users/8109341/daniel 's answer:
On Ubuntu, I had to wrap $@ in double quotes: "$@", otherwise passing arguments would break:
E.g.:
Running npx ganache-cli -m "strike artwork yard vault enhance despair online sock feed cactus subject rebela" -i 15
Would have process.argv evaluated to:
[ '/usr/bin/node_bin',
'/home/daniel/repos/aragon/aragen/node_modules/.bin/ganache-cli',
'-m',
'strike',
'artwork',
'yard',
'vault',
'enhance',
'despair',
'online',
'sock',
'feed',
'cactus',
'subject',
'rebel',
'-i',
'15']
instead of:
[ '/usr/bin/node_bin',
'/home/daniel/repos/aragon/aragen/node_modules/.bin/ganache-cli',
'-m',
'strike artwork yard vault enhance despair online sock feed cactus subject rebel',
'-i',
'15']
TL;DR
- Rename the node binary:
sudo mv /usr/bin/node /usr/bin/node_bin
- Create the shell script:
cat << EOF | sudo tee /usr/bin/node
#!/bin/bash
/usr/bin/node_bin --stack-size=4096 "\$@"
EOF
- Make the shell script executable:
sudo chmod +x node