Global Node modules not installing correctly. Command not found

前端 未结 9 1045
北荒
北荒 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条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 20:39

    In my case, The NODE_PATH environment variable was empty. Check whether it is empty-

    echo $NODE_PATH
    

    if the NODE_PATH is empty. Then change ~/.bash_profile and add NODE_PATH

    nano ~/.bash_profile
    export NODE_PATH=`npm root -g`
    source ~/.bash_profile
    

    Now install npm modules again and check whether that is being installed on the path npm root -g

提交回复
热议问题