Volta and global npm package

9k Views Asked by At

I try Volta tools on existing Node project. This is very great tools :)

But, can i use global package ? For example, i've run :

npm i -g gitmoji-cli

Then, i try to use gitmoji, but it's undefined on the command line. I'm on the right node version, but i don't really understand why the gitmoji is not found.

Do you know if I need other param ?

If anyone have already use this tool and installing global package .. :)

enter image description here

3

There are 3 best solutions below

1
On

When you install a package to your toolchain, Volta takes your current default Node version and pins the tool to that engine

1
On

You can install global packages using volta install <package>. In your case, it would be volta install gitmoji-cli.

Volta will then install the package and make it available anywhere in your terminal. However, if you open the terminal in a project that has that package listed as a dependency, or dev dependency, Volta will use the package from the node_modules of that project instead.

For more information see: global-installs-done-right

0
On

Yes, Volta works Well with global package installation.

I try your command and it's OK:

npm i -g gitmoji-cli 

if it's not working for you, try openning "cmd" with "Run as administrator" option.

or, as volta documentation recommends, enable "Developer Mode" in Windows:

NOTE

Volta's functionality depends on creating symlinks, so you must either:

Enable Developer Mode (recommended)

Run Volta with elevated privileges (not recommended)