首页 > 代码库 > bash: /usr/bin/npm: No such file or directory
bash: /usr/bin/npm: No such file or directory
一个整得很烂了的Ubuntu服务器, 各种问题乱出. npm老是升不到最新版(一直显示1.4),于是我干脆删了, 结果再去装却装不上了, 如果用apt-get install npm
安装, 就得到如下错误:
The following packages have unmet dependencies:npm : Depends: nodejs but it is not going to be installed Depends: nodejs-dev Depends: node-request but it is not going to be installed Depends: node-mkdirp but it is not going to be installed Depends: node-minimatch but it is not going to be installed Depends: node-semver but it is not going to be installed Depends: node-ini but it is not going to be installed Depends: node-graceful-fs but it is not going to be installed Depends: node-abbrev but it is not going to be installed Depends: node-nopt but it is not going to be installed Depends: node-fstream but it is not going to be installed Depends: node-rimraf but it is not going to be installed Depends: node-tar but it is not going to be installed Depends: node-which but it is not going to be installedE: Unable to correct problems, you have held broken packages.
官网居然只提供这种方法,结果发现在其github主页上提供的方法是: curl -L https://npmjs.com/install.sh | sh
成功.
仍然不能用:
npm -vbash: /usr/bin/npm: No such file or directory
一通乱搜, 对着各种解决方法乱试, 也没真正解决,那只有自己思考一下了:
- npm既然装上了,那么装到哪去了(找到了)
- 直接到安装目录执行(成功了)
- 那么就软链一下试试(成功了)
root@walker:~# find / -name "npm-cli.js" /root/.node/lib/node_modules/npm/bin/npm-cli.js root@walker:~# /root/.node/lib/node_modules/npm/bin/npm-cli.js -v 2.1.17 root@walker:~# ln -s /root/.node/lib/node_modules/npm/bin/npm-cli.js /usr/bin/npm root@walker:~# npm -v 2.1.17
bash: /usr/bin/npm: No such file or directory
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。