一个整得很烂了的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 installed
E: Unable to correct problems, you have held broken packages.

官网居然只提供这种方法,结果发现在其github主页上提供的方法是: curl -L https://npmjs.com/install.sh | sh 成功.

仍然不能用:

npm -v
bash: /usr/bin/npm: No such file or directory

一通乱搜, 对着各种解决方法乱试, 也没真正解决,那只有自己思考一下了:

  1. npm既然装上了,那么装到哪去了(找到了)
  2. 直接到安装目录执行(成功了)
  3. 那么就软链一下试试(成功了)
    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

p.s. 虽然npm正常工作了,最后发现npm install一个包都下不下来, 执行了一句npm cache clean,貌似就OK了

bash: /usr/bin/npm: No such file or directory的更多相关文章

  1. linux输入yum后提示: -bash: /usr/bin/yum: No such file or directory的解决方案

    linux输入yum后提示: -bash: /usr/bin/yum: No such file or directory的解决方案 今天在安装程序时,发现有一个插件未安装,我就随手敲了一个命令,看都 ...

  2. xmanager运行报错:bash: /usr/bin/xterm: No such file or directory

    1.原因 xterm没有安装,解决办法是下载然后安装即可. 如果机器可以用yum,则直接使用yum安装xterm即可: yum install -y xterm 如果没有网络,则在某台操作系统大版本相 ...

  3. git 源码安装后报错/usr/bin/git: No such file or directory

    现象 今天源码安装一个git后,执行git命令后报如下错误: $ git --version -bash: /usr/bin/git: No such file or directory 分析过程 开 ...

  4. java配置好jdk-bash: /usr/bin/java: No such file or directory

    在 Linux 系统中安装 JDK 环境,配置好环境变量后,输入 java.javac 或者 java -version 等时,都提示如下错误: -bash: /usr/local/java/bin/ ...

  5. zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory

    系统升级为 macOS Catalina 发现 CocoaPods 不管用了. 解决方法: 打开 iTerm2 sudo gem update --system 输入电脑密码,然后 sudo gem ...

  6. -bash: /usr/librxec/grepconf.sh:Nosuch file or directory

    最近修改/etc/profile文件时,不小心在后面添加了source /etc/profile,导致使用xshell登录远程linux的时候出现下面的信息, 一直无法进入linux,将profile ...

  7. -bash: /usr/local/bin/react-native: No such file or directory

    执行react-native run-android/run-ios的时候出现 -bash: /usr/local/bin/react-native: No such file or director ...

  8. bash: /usr/lib/jvm/jdk1.7.0_80/bin/java: No such file or directory 问题

    在安装java的时候,经常会遇到一些奇奇怪怪的问题. 在配置好环境变量之后,执行java -version,出现: bash: /usr/lib/jvm/jdk1.7.0_80/bin/java: N ...

  9. -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory

    -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory python多版本造成额问题 找不到p ...

随机推荐

  1. JAVA-数据库之删除记录

    相关资料:<21天学通Java Web开发> 删除记录 Statementdelete.jsp <%@ page language="java" contentT ...

  2. JAVA-JSP内置对象之request对象参数

    相关资料:<21天学通Java Web开发> request对象1.request对象不但可以用来设置和取得requset范围变量,还可以用来获得客户端请求参数请求的来源.表头.cooki ...

  3. C++连接Mysql数据库操作

    参考文章 http://www.cnblogs.com/justinzhang/archive/2011/09/23/2185963.html 写的很详细 http://blog.csdn.net/j ...

  4. 在分布式系统里看CAP定理

    本文转自:http://zhuanlan.51cto.com/art/201703/534587.htm 计算机界有很多高大上又难于理解的术语,CAP就是其中之一, 什么一致性(Consistency ...

  5. 调整Intellij IDEA内存

    最近IDEA真是卡的要死,下面

  6. C++11中如何输出enum class的值

    Unlike an unscoped enumeration, a scoped enumeration is not implicitly convertible to its integer va ...

  7. STM32 双ADC同步规则采样

      最近需要用到两个ADC对电压电流进行同步采样,看了一下STM32的ADC介绍,发现STM32最多有3个独立ADC,有在双AD模式下可以进行同步测量,正好满足我的要求.参考官方给的例子在结合自己的需 ...

  8. 开源网站访问统计系统Piwik

    http://www.piwik.cn/ http://www.piwik.org/ Piwik 是一套基于 Php+MySQL 技术构建,能够与 Google Analytics 相媲美的开源网站访 ...

  9. (转)CDH中启动的hive,使用jdbc连接hiveServer2时候权限不足解决方案

    Hive JDBC:java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.securi ...

  10. drupal

    一 devel 模块 配置->development->generate users 添加测试账号 php区块 结构->区块->switch user 使用者切换 结构-> ...