Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternatives to nvm? [closed]

Tags:

node.js

npm

nvm

I really just need something I can check into version control to declare a Node version, and swap out the Node version in someone's shell while they're in that directory.

.nvmrc is supposed to do this but there's no official support for Fish and workarounds are junk.

This doesn't seem terribly complicated. Is there anything new/hawt to replace nvm?

like image 973
corysimmons Avatar asked Nov 27 '17 09:11

corysimmons


1 Answers

I use volta as replacement. It doesn't use the .nvmrc but a configuration in the package.json.

It's a great solution in my eyes because it uses shims, so it is completely independent of the shell you use. It doesn't has to be integrated in there. Instead of a normal node installation you (or the installation) puts volta in the PATH variable of you OS. So you are using node, npm, yarn, ... normally, but internally it's calling volta and volta checks your package.json and uses the node/yarn/... version configured there, or the global version if there is no volta configuration. So if you switch a project with cd ../xyz volta also changes the node version or installs it if it is missing without the need to run a command or something. So no nvm use or fnm use necessary.

Except from IntelliJ-Issue WEB-44867 (that requires a bit of manual extra configuration) it works perfectly for me.

like image 177
Nico Avatar answered Sep 27 '22 21:09

Nico