2013-03-04 95 views
5

爲什麼在嘗試安裝socket.io時出現此錯誤。我正在使用最新版本的NodeJS並設置路徑變量。 我在cmd中以管理員權限使用Windows 7。爲什麼在嘗試安裝socket.io時遇到錯誤nmp

> [email protected] install C:\Users\Dusan\node_modules\socket.io\node_modules\socket.io 
-client\node_modules\ws 
> (node-gyp rebuild 2> builderror.log) || (exit 0) 

CreateProcessW: The system cannot find the file specified. 
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'C:\Users\Dusan\node_modules 
\socket.io\node_modules\socket.io-client\node_modules\active-x-obfuscator\node_m 
odules\zeparser' 
npm ERR! error rolling back [email protected] { [Error: ENOTEMPTY, rmdir 
'C:\Users\Dusan\node_modules\socket.io\node_modules\socket.io-client\node_module 
s\active-x-obfuscator\node_modules\zeparser'] 
npm ERR! error rolling back errno: 53, 
npm ERR! error rolling back code: 'ENOTEMPTY', 
npm ERR! error rolling back path: 'C:\\Users\\Dusan\\node_modules\\socket.io\\ 
node_modules\\socket.io-client\\node_modules\\active-x-obfuscator\\node_modules\ 
\zeparser' } 
npm ERR! error rolling back Error: EPERM, rmdir 'C:\Users\Dusan\node_modules\soc 
ket.io\node_modules\socket.io-client\node_modules\active-x-obfuscator\node_modul 
es\zeparser\benchmark.html' 
npm ERR! error rolling back [email protected] { [Error: EPERM, rmdir 'C:\Users\D 
usan\node_modules\socket.io\node_modules\socket.io-client\node_modules\active-x- 
obfuscator\node_modules\zeparser\benchmark.html'] 
npm ERR! error rolling back errno: 50, 
npm ERR! error rolling back code: 'EPERM', 
npm ERR! error rolling back path: 'C:\\Users\\Dusan\\node_modules\\socket.io\\ 
node_modules\\socket.io-client\\node_modules\\active-x-obfuscator\\node_modules\ 
\zeparser\\benchmark.html' } 
npm ERR! [email protected] install: `(node-gyp rebuild 2> builderror.log) || (exit 0)` 
npm ERR! `cmd "/c" "(node-gyp rebuild 2> builderror.log) || (exit 0)"` failed wi 
th 127 
npm ERR! 
npm ERR! Failed at the [email protected] install script. 
npm ERR! This is most likely a problem with the ws package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  (node-gyp rebuild 2> builderror.log) || (exit 0) 
npm ERR! You can get their info via: 
npm ERR!  npm owner ls ws 
npm ERR! There is likely additional logging output above. 

npm ERR! System Windows_NT 6.1.7600 
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File 
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "socket.io" 
npm ERR! cwd C:\Users\Dusan 
npm ERR! node -v v0.8.21 
npm ERR! npm -v 1.2.11 
npm ERR! code ELIFECYCLE 
npm ERR! Error: ENOENT, lstat 'C:\Users\Dusan\node_modules\socket.io\node_module 
s\socket.io-client\node_modules\active-x-obfuscator\node_modules\zeparser\benchm 
ark.html' 
npm ERR! If you need help, you may report this log at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to: 
npm ERR!  <[email protected].com> 

npm ERR! System Windows_NT 6.1.7600 
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File 
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "socket.io" 
npm ERR! cwd C:\Users\Dusan 
npm ERR! node -v v0.8.21 
npm ERR! npm -v 1.2.11 
npm ERR! path C:\Users\Dusan\node_modules\socket.io\node_modules\socket.io-clien 
t\node_modules\active-x-obfuscator\node_modules\zeparser\benchmark.html 
npm ERR! fstream_path C:\Users\Dusan\node_modules\socket.io\node_modules\socket. 
io-client\node_modules\active-x-obfuscator\node_modules\zeparser\benchmark.html 
npm ERR! fstream_type File 
npm ERR! fstream_class FileWriter 
npm ERR! code ENOENT 
npm ERR! errno 34 
npm ERR! fstream_stack C:\Program Files (x86)\nodejs\node_modules\npm\node_modul 
es\fstream\lib\writer.js:284:26 
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15) 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  C:\Users\Dusan\npm-debug.log 
npm ERR! not ok code 0 

我不知道發佈此問題的其他方式。請編輯這個。

回答

11

嘗試將c:\windows\system32添加到您的PATH。由於您以管理員身份使用cmd,因此目錄會有所不同。

請參閱socket.io問題,報告here。 Windows上的另一個類似問題SO

+0

謝謝你,這是我一直在尋找。 – carobnodrvo 2013-03-04 18:38:44

+0

我希望我可以給你更多的積分,你的回答在兩個月前救了我,在這裏我今天再次與同一問題... – Narretz 2013-04-26 14:52:20

0

我不需要安裝node-gyp,但它看起來像你一樣。首先運行這個,

$ npm install -g node-gyp 

然後再試一次。如果失敗,請爲PATH傳播重新啓動計算機。

+7

這並沒有幫助我。 – carobnodrvo 2013-03-04 18:38:23

3

我在Mac上有類似的問題。 什麼解決了我的問題是安裝稍微舊版本的Socket.io。

我所做的:

npm install [email protected]"~0.8.1" 

這將安裝0.8.0的最新版本0.8.9,而不是0.9.0或以上。

Socket.io then installed perfectly. 

我也裝

sudo npm install -g node-gyp 

,但它本身並沒有解決問題。

+0

謝謝@Daniel。這對Ubuntu 13.10 64bit也有幫助。 – 2013-11-03 13:54:16

+0

爲我工作。謝謝 – Steffi 2014-08-01 12:37:23

+0

在我的win7機器上工作,謝謝。 – svarog 2014-11-06 09:37:01

4

給所有在共享文件夾的虛擬機上與此鬥爭的人。沒有任何這些建議,我沒有運氣,但一段時間後,我試圖安裝到另一個不是共享文件夾的位置,一切都完美無缺。或者您可以嘗試從託管虛擬機的主計算機將其安裝到該文件夾​​。希望這會幫助某人。

+0

確認。我在共享文件夾中遇到了同樣的問題,但'npm install socket.io'沒有版本規範(當前爲0.9),在我的主目錄中工作正常。 我發現http://askubuntu.com/a/269735/91786也很有幫助。它說使用'--no-bin-links'選項是合理的,因爲Windows(我的主機系統)不支持符號鏈接。 – N13 2014-02-19 17:09:09

0

要使用最新版本的socket.io的...首先確保您擁有所有必需的軟件運行node-gyp

您可以配置使用的Visual Studio版本通過gyp通過一個環境變量,所以你可以避免必須設置--msvs_version=2012屬性。

例子:

  • 設置GYP_MSVS_VERSION=2012爲Visual Studio 2012
  • 設置GYP_MSVS_VERSION=2013e(在 'E' 代表 'Express版')

有關完整列表,請參閱 - https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294

對於NodeJS的Windows用戶來說,這仍然很痛苦,因爲它假定你有一個Python和Visu的副本al Studio已安裝,許多最終用戶將永遠不會擁有此功能。因此,我正在向Joyent遊說,鼓勵他們將網絡套接字包含爲CORE節點的一部分,並且還可以將GNU gcc編譯器作爲NodeJS安裝的一部分發布,以便我們可以永久解決此問題。

隨意在添加您的投票:

相關問題