Running shakapacker-dev-server via NVM not working anymore after upgrading to 8.0.0
Closed this issue · 1 comments
Notice: A bug is a crash or incorrect behavior. If you have a debugging or troubleshooting question, please open a discussion on the Discussions Tab. Otherwise, remove this line and fill out the following sections.
Expected behavior:
My npm run webpack
command should launch shakapacker-dev-server successfully (like before the upgrade from 7x latest).
Actual behavior:
npm run webpack
> company@1.0.0 webpack
> source $HOME/.nvm/nvm.sh; nvm use; NODE_OPTIONS=--max-old-space-size=8192 bin/shakapacker-dev-server
Found '/username/coding/company/.nvmrc' with version <v20.12.2>
Now using node v20.12.2 (npm v6.14.18)
Usage: npm <command>
where <command> is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
clean-install, clean-install-test, completion, config,
create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
edit, explore, fund, get, help, help-search, hook, i, init,
install, install-ci-test, install-test, it, link, list, ln,
login, logout, ls, org, outdated, owner, pack, ping, prefix,
profile, prune, publish, rb, rebuild, repo, restart, root,
run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami
npm <command> -h quick help on <command>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
/Users/peterlampesberger/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@6.14.18 /username/coding/company/node_modules/npm
Small, reproducible repo:
Here is my current package.json start command:
"packageManager": "npm@10.5.0",
"scripts": {
"webpack": "source $HOME/.nvm/nvm.sh; nvm use; NODE_OPTIONS=--max-old-space-size=8192 bin/shakapacker-dev-server",
},
But it worked also without mentioning the nvm before the upgrade:
"scripts": {
"webpack": "NODE_OPTIONS=--max-old-space-size=8192 bin/shakapacker-dev-server",
},
Hints
It seems that its related to that the nvm env is going missing on the way and its using the (wrong) system npm executable. I tried to run the start command with backticks or `` but got the same out put here:
Running the output command source $HOME/.nvm/nvm.sh; nvm use; NODE_OPTIONS=--max-old-space-size=8192 bin/shakapacker-dev-server
works fine without going through npm run webpack
🤷
Setup environment:
- Ruby version: 3.1.4
- Rails version: 6.1
- Shakapacker version: 8.0.0
Any idea on how to get it working again?
Ah damnn.....
I had an outdated "npm" entry in my package.json devDependencies. After updating it it works fine... arrr