Tried these:
✗ nvm run 9 npm start
Running node v9.10.1 (npm v5.8.0)
module.js:545
throw err;
^
Error: Cannot find module '/Users/foo/work/grid-styled/npm'
at Function.Module._resolveFilename (module.js:543:15)
✗ nvm run 9 npm -- x0 dev docs/App.js
Running node v9.10.1 (npm v5.8.0)
module.js:545
throw err;
^
Error: Cannot find module '/Users/foo/work/grid-styled/npm'
I can get it to run by calling the bin directly:
nvm run 9 node_modules/.bin/x0 dev docs/App.js
But it would be better to just call npm. Seems possible but the nvm docs don't address this use case.
If you want to downgrade npm to a specific version, you can use the following command: npm install -g npm@[version. number] where the number can be like 4.9. 1 or 8 or v6.
If you want to switch to the different version of Node, just type n in the terminal and you should see the Node versions listed. Use arrow keys to choose the version and press enter.
nvm manages node. js and npm versions. It's designed to be installed per-user and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL.
If you use nvm run
you are executing node on a specific version, so:
nvm run 9 npm start
is equivalent to node npm start
(with version 9 of node). That's the reason for the error.
You should use nvm exec
instead, that is for executing a command on specific version, for instance:
$ nvm exec 10 npm -v
Running node v10.0.0 (npm v6.0.0)
6.0.0
$ nvm exec 6 npm -v
Running node v6.10.3 (npm v3.10.10)
3.10.10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With