【问题标题】:node.js npm install issuenode.js npm 安装问题
【发布时间】:2013-07-23 11:33:48
【问题描述】:

我遵循了这个指示。

我的 linux 机器是 CentOS 5.5,所以如果你有 ubuntu,请参阅此站点以获取节点和 socket.io。

NodeJS

  1. 确保您已安装 git,或者直接获取:

sudo yum install git

  1. 从它的 github 站点获取 node 的最后一个源:

git clone http://github.com/ry/node.git && cd 节点

./配置

制作

进行安装

  1. 现在您可以运行“node -v”命令并安装当前版本。

节点包管理器 (NPM)

这是一个包管理器,类似于 ruby​​ 世界中的 gems。安装很简单:

卷曲http://npmjs.org/install.sh |嘘

就是这样。

快递

由于您已经安装了 NPM,接下来的步骤非常简单,只需让 NPM 为您完成所有工作:

npm install express

表达-v

您应该会看到系统中安装了 express 版本。

==================================

安装 node.js 成功

如果我输入 node -v

上面写着 v0.2.5

之后,

我尝试安装 npm

但它说

[root@gcloud node]# curl http://npmjs.org/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    85    0    85    0     0    128      0 --:--:-- --:--:-- --:--:--   395
sh: line 1: syntax error near unexpected token `newline'
sh: line 1: `<html>Moved: <a href="https://npmjs.org/install.sh">https://npmjs.org/install.sh</a>'

我尝试了其他命令,

卷曲 -O https://npmjs.org/install.sh sudo sh install.sh

它说

[root@gcloud node]# curl -s https://npmjs.org/install.sh > npm-install-$$.sh
[root@gcloud node]# sh npm-install-*.sh
tar=/bin/tar
version:
tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

由约翰·吉尔摩和杰伊·芬拉森撰写。 您使用的是过时且不受支持的版本 节点(v0.2.5)。请更新节点并重试。

【问题讨论】:

  • 在使用其他说明之前,您是否尝试过安装 Node?看起来很久以前您安装了旧版本的 Node,它正在破坏您的新安装。

标签: node.js socket.io


【解决方案1】:

正如错误提示,您安装的 Node 版本不受您尝试安装的 npm 版本的支持:

您使用的是过时且不受支持的节点版本 (v0.2.5)。请更新节点并重试。

Node 的最新稳定版本是v0.10.13。您可以从the "Download" pagefrom the blog entry 下载其源代码。还有许多可用于不同系统的预编译二进制存档。

您还可以在the project's wiki 中找到更新的安装指南,以及installing via package managers 的说明,包括installing via yum for CentOS

另请注意,Node 的 git 存储库不久前已移至 https://github.com/joyent/node

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-24
    • 2018-08-27
    • 2016-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多