quokka
quokka copied to clipboard
Fully support nvm
Issue description or question
As I understand it, nvm
is only supported via explicit configuration. This can cause obvious issues when changing/removing node
versions with nvm
. In my opinion, nvm
and other node version managers should work without configuration. I think something like sindresorhus/run-node could be used to solve this.
OS name and version
OSX 10.13.6
Thanks for sharing run-node
, will investigate if we can use it.
This can cause obvious issues when changing/removing
node
versions withnvm
.
This can be used as a version change resistant way for nvm
specifically to always use current nvm node version:
"node": "~/.nvm/current/bin/node"
I thought they removed the current
symlink, but it looks like it just isn't enabled by default.
nvm use will not, by default, create a "current" symlink. Set $NVM_SYMLINK_CURRENT to "true" to enable this behavior, which is sometimes useful for IDEs. Note that using nvm in multiple shell tabs with this environment variable enabled can cause race conditions.
I think the best way to support nvm would be to allow this bash substitutions in the config, this works in bash
{
"node": "$(nvm which current)"
}
if you allow that and also add it to your documentation here https://quokkajs.com/docs/configuration.html#nodejs-version it would be a quick and easy change for users
I think the best way to support nvm would be to allow this bash substitutions in the config, this works in bash
Unfortunately we support multiple operating systems and bash isn't common to all operating systems so this syntax isn't an option. By default, if node
is in your system path (note this is different from path being added when you start your shell) then you should not need to specify the node path at all and Quokka will automatically use the current version of node specified using nvm. Alternatively, you may try using the $NVM_SYMLINK_CURRENT
option mentioned above and then use the symlink created by nvm.
Just solved this for myself in Ubuntu bash shell. Have written it down what i did in this gist below after a bit of reading here and other places.Maybe it can help someone.
https://gist.github.com/madhu-sagar/570de73ff6949f33d9d40374fe184c7b
Please add support for nvm-windows :(
Thanks for sharing
run-node
, will investigate if we can use it.This can cause obvious issues when changing/removing
node
versions withnvm
.This can be used as a version change resistant way for
nvm
specifically to always use current nvm node version:"node": "~/.nvm/current/bin/node"
I'm just giving this a try (after doing similar for Wallaby). I appreciate the config is slightly different using the key node
and I've put it within ~/.quokka
instead. However I can't seem to get it to pick this setting up, constantly complaining about Node being unavailable. Is there anyway I can debug this? The same value works fine in Wallaby.
{
"node": "/Users/ian/.nvm/versions/node/v20.11.1/bin/node"
}
@IPWright83 - the configuration file for Quokka should be ~/.quokka/config.json
.
If you are using Quokka PRO, it should look like this:
{
"node": "/Users/ian/.nvm/versions/node/v20.11.1/bin/node",
"pro": true
}
If you are using Quokka Community, it should look like this:
{
"node": "/Users/ian/.nvm/versions/node/v20.11.1/bin/node",
"pro": false
}