Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NVM managed npm globally installed packages return command not found

I have nvm installed to manage my node versions. If I install a package globally, npm install -g fkill, then run fkill, I get the error zsh: command not found: fkill.

Here are some commands run to help with debugging this

$ npm root -g
/home/jchi/.nvm/versions/node/v10.15.3/lib/node_modules

Looking at my PATH...

$ echo $PATH
/home/jchi/.pyenv/shims:/home/jchi/.pyenv/bin:/home/jchi/.nix-profile/bin:/home/jchi/.autojump/bin:/home/jchi/.nvm/versions/node/v10.15.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/games

I do not see the output of npm root -g in my PATH.

I assume is nvm's responsibility to add that to my path so globally installed packages can be run. So I look at what I have in my .zshrc that kickstarts nvm.

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
  105 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

Suggestions appreciated

like image 683
jchi2241 Avatar asked Dec 11 '19 22:12

jchi2241


1 Answers

Looking at your PATH, you do have the nvm bin folder under your PATH. /home/jchi/.nvm/versions/node/v10.15.3/bin

I would suggest to check if you have prefix related settings in ~/.npmrc.

If you have any prefix settings, please remove it.

Then try running npm install -g fkill again.

like image 200
Wesgur Avatar answered Nov 10 '22 04:11

Wesgur