13

bash: npm: command not found 的一种解决方案

 2 years ago
source link: https://shenzilong.cn/other/bash:%20npm:%20command%20not%20found%20%E7%9A%84%E4%B8%80%E7%A7%8D%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

bash: npm: command not found 的一种解决方案

由于我使用 n 来管理多个 node.js 版本,所以当报错如下的时候

/bin/bash: npm: command not found

我有猜测是不是 /bin/bash 找不到相关命令

使用 whereis npm 查看 npm 命令所在位置

> whereis npm
npm: /root/n/bin/npm

根据在网上搜索知道 bash 会去 /usr/bin/ 下寻找命令

然后使用 ln 命令将 /root/n/bin/npm 链接到 /usr/bin/npm 即可

sudo ln -s /root/n/bin/npm /usr/bin/npm

如果 node 命令也无法找到则照搬上方的流程

链接到此文档的相关文档

bash: npm: command not found 的一种解决方案

by 崮生 from 崮生 • 一些随笔 🎨,欢迎 赞助本文
本文欢迎分享与聚合,全文转载未经授权( 联系我)不许可。

神仙散棒槌IT源点monaco-editor崮生 • 一些随笔 🎨 赞助我 copyright © 2018.11.6 - 2021.10 湘ICP备18021783号 GIT HUB


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK