Can the VSCode NPM Script Explorer source .nvmrc before running a script?

Viewed 107

When running an NPM script from the script explorer, it uses NVM's default version of node. Instead, I'd like to use the version dictated by .nvmrc. Is that possible?

1 Answers

There are several extensions that run nvm use on each terminal opened if an .nvmrc file is found in the workspace. These work for the NPM Script Explorer too.

The most downloaded one is called vsc-nvm.

In case it does not work out of the box, note that it runs nvm use in a /bin/sh shell, therefore you need to make sure nvm is accessible and works as intended from within sh.

P.S. This sounds like a good feature to add to the NPM Script Explorer itself, but as far as I can see, nobody suggested it yet.

Related