在~/.bashrc后加上
export PATH=$PATH:/home/test/.npm-global/bin
绿色部分是我的路径,你可以替换成你的
参考链接:https://blog.csdn.net/m0_37263637/article/details/81942435