无法以非 root 用户身份安装 NPM

无法以非 root 用户身份安装 NPM

因此,我花了几个小时尝试自己修复这个问题,但我觉得情况变得更糟了。我正在运行 Kbuntu 12.10,并尝试以非 root 用户身份安装 nodejs 和 npm,以便我可以安装游戏闭包框架。我以 root 身份安装了 node 和 npm 版本。然后尝试通过以下说明再次安装它(不删除旧版本):http://tnovelli.net/blog/blog.2011-08-27.node-npm-user-install.html

现在当我输入时,which npm我什么也得不到。但是当我输入时,which node我得到了/home/myusername/.local/bin/node。所以我假设节点已正确安装。

当我输入时npm -v

我得到:

The program 'npm' is currently not installed. You can install it by typing:
sudo apt-get install npm

所以我输入sudo apt-get install npm

响应是:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
npm : Depends: nodejs (>= 0.6.19~dfsg1-3) but it is not going to be installed
   Depends: nodejs-dev
   Depends: node-node-uuid but it is not going to be installed
   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.

我该如何修复这个问题,以便我可以根据上面的链接安装 npm?

编辑:经过更多搜索后,我尝试了sudo apt-get clean && sudo apt-get update ,即使在那之后,我在尝试 apt-get npm 后仍然收到相同的消息

相关内容