【发布时间】:2013-07-23 11:33:48
【问题描述】:
我遵循了这个指示。
我的 linux 机器是 CentOS 5.5,所以如果你有 ubuntu,请参阅此站点以获取节点和 socket.io。
NodeJS
- 确保您已安装 git,或者直接获取:
sudo yum install git
- 从它的 github 站点获取 node 的最后一个源:
git clone http://github.com/ry/node.git && cd 节点
./配置
制作
进行安装
- 现在您可以运行“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,它正在破坏您的新安装。