2013-07-23 36 views
0

我遵循這條指令。node.js npm安裝問題

我的linux系統是CentOS 5.5,所以如果你有ubuntu,請參考這個站點來獲取node和socket.io。

的NodeJS

  1. 確保你已經安裝的git,或者只是得到它:

須藤yum的安裝混帳

  1. 獲取節點的最後一個來源,從它的GitHub的網站:

git clone http://github.com/ry/node.git & & CD節點

的./configure

使

使安裝

  1. 現在你已經能夠運行 「節點-v」 命令,並得到安裝最新版本。

節點程序包管理器(NPM)

這是一個包管理器,類似於Ruby世界寶石。安裝非常簡單:

curl http://npmjs.org/install.sh | sh

就是這樣。

快遞

當你有NPM安裝在接下來的步驟是很容易的,只是讓NPM爲你做所有的工作:

故宮安裝快車

表達-v

您應該看到系統中安裝的快速版本。

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

succeded安裝的node.js

如果我鍵入node -v

它說v0.2。5

後,

我試圖安裝NPM

但它說

[[email protected] 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 須藤SH install.sh

它說

[[email protected] node]# curl -s https://npmjs.org/install.sh > npm-install-$$.sh 
[[email protected] 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. 

作者:約翰吉爾摩和傑伊Fenlason。 您正在使用過期並且不受支持的 節點版本(v0.2.5)。請更新節點並重試。

+0

您是否曾嘗試在使用其他一些說明之前安裝Node?看起來不久前,您安裝了舊版本的Node,它正在破壞您的新安裝。 – icktoofay

回答

1

由於錯誤表明,你已經安裝節點的版本不是由的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

+0

謝謝你。我解決了這個問題,它有效! – user1765884