Global Node modules not installing correctly. Command not found

前端 未结 9 1035
北荒
北荒 2020-11-29 20:26

I am having a problem installing global node modules and everything I find online says the solve is just adding -g. Which is not the problem. I believe it\'s a linking issue

9条回答
  •  -上瘾入骨i
    2020-11-29 20:34

    Check your global Node module's binary folder, and add it to your $PATH.

    npm list -g | head -1
    

    If you use nodenv, the path will change whenever you install the global node version. Adding the path like this solves my problem.

    "$HOME/.nodenv/versions/$(nodenv global)/bin"
    

    Shortcut for adding the path to zsh

    $ echo 'export PATH="$HOME/.nodenv/versions/$(nodenv global)/bin"' >> ~/.zshrc
    

提交回复
热议问题