我已经从源头正确安装了js节点,并且我尝试安装npm但我收到错误并不重要。
我主要关注此链接:Installing Node and Npm from source
如果我尝试克隆npm存储库并在继续make install之后收到此错误消息:
scripts/doc-build.sh: line 58: ./node_modules/.bin/marked: No such file or directory
make: *** [html/doc/api/npm-uninstall.html] Error 1
如果我选择使用sript(wget或curl)从源代码安装,我会收到错误(使用http或https,并不重要):
wget http://npmjs.org/install.sh
--2014-05-13 00:52:25-- http://npmjs.org/install.sh
Connecting to 127.0.0.1:8118... failed: Connection refused.
如果我尝试使用curl,我会收到另一条错误消息:
curl https://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) couldn't connect to host
如果我尝试使用sudo 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.
node -v
v0.11.14-pre
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.4 LTS
Release: 12.04
Codename: precise
which node
/home/user/local/node/node
我不知道自己能解决这个问题,直到现在我整天都陷入困境。
谢谢,如果有人可以帮助我。
答案 0 :(得分:2)
安装nodejs软件包时,AFAIK和节点二进制文件一起安装。
答案 1 :(得分:1)
我遇到了同样的问题。至于最后一个依赖问题,请转到/etc/apt/sources.list.d
并删除任何节点相关列表(如果有)。如果你回来安装npm你就不会遇到任何依赖问题。
但我强烈建议不要使用apt-get安装npm。 当您按照nodejs网站(通过包管理器)的说明时,它默认出现在nodejs中。这里有另一个问题。您需要sudo权限才能通过此方法安装nodejs。如果你使用sudo来安装nodejs和npm,你将来会遇到问题。阅读this以了解如何在开发机器和生产机器中正确安装节点。
始终使用nvm在dev机器中安装nodejs和npm。通过这种方式,你可以避免使用sudo从npm安装其他工具,如yo,grunt,bower。
简而言之,