2013-06-02 93 views
1

我通過安裝Node.js和node-v0.10.9-x64.msi安裝程序來跟隨CoffeeScript installation guide。然後,我用我的.coffee文件啓動了一個cygwin控制檯並將cd'd放入目錄中。如果我本身鍵入coffee全部,它給了我這個錯誤:爲什麼我在cygwin中運行coffee命令時出錯?

$ coffee 
coffee> 
events.js:72 
     throw er; // Unhandled 'error' event 
      ^
Error: read ENOTCONN 
    at errnoException (net.js:884:11) 
    at Socket._read (net.js:389:21) 
    at Socket.Readable.read (_stream_readable.js:320:10) 
    at Socket.read (net.js:291:43) 
    at new Socket (net.js:185:10) 
    at process.stdin (node.js:660:19) 
    at new REPLServer (repl.js:132:15) 
    at Object.exports.start (repl.js:312:14) 
    at Object.module.exports.start (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\repl.js:106:23) 
    at Object.exports.run (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:77:32) 
    at Object.<anonymous> (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\bin\coffee:7:41) 
    at Module._compile (module.js:456:26) 
    at Object.Module._extensions..js (module.js:474:10) 
    at Module.load (module.js:356:32) 
    at Function.Module._load (module.js:312:12) 
    at Function.Module.runMain (module.js:497:10) 
    at startup (node.js:119:16) 
    at node.js:901:3 

如果我運行-lw命令它給我這個錯誤:

$ coffee -lw Example.js.coffee 
Error: This socket is closed. 
    at Socket._write (net.js:618:19) 
    at doWrite (_stream_writable.js:219:10) 
    at writeOrBuffer (_stream_writable.js:209:5) 
    at Socket.Writable.write (_stream_writable.js:180:11) 
    at Socket.write (net.js:596:40) 
    at lint (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:468:15) 
    at compileScript (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:193:18) 
    at C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:144:18 
    at fs.js:266:14 
    at Object.oncomplete (fs.js:107:15) 

events.js:72 
     throw er; // Unhandled 'error' event 
      ^
Error: spawn ENOENT 
    at errnoException (child_process.js:980:11) 
    at Process.ChildProcess._handle.onexit (child_process.js:771:34) 

如果我只用-l運行選項它給了我這個錯誤:

$ coffee -l Example.coffee 
Error: This socket is closed. 
    at Socket._write (net.js:618:19) 
    at doWrite (_stream_writable.js:219:10) 
    at writeOrBuffer (_stream_writable.js:209:5) 
    at Socket.Writable.write (_stream_writable.js:180:11) 
    at Socket.write (net.js:596:40) 
    at lint (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:468:15) 
    at compileScript (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:193:18) 
    at C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:144:18 
    at fs.js:266:14 
    at Object.oncomplete (fs.js:107:15) 

但好像我可以編譯和/或不掉毛可以選擇觀看選項,並事情正常工作。

我對Node.js一無所知。我試着用Google搜索這些錯誤,並且看到與使用中的端口和套接字問題相關的類似問題。我認爲注意到我使用Intellij IDEA(一個IDE)並且它有一個可能干擾的CoffeeScript插件可能是有用的。但是當我關閉Intellij時,我仍然得到這些相同的錯誤,所以這可能是一個紅鯡魚。

此外,也許有一個特定的cygwin版本的node.js我應該安裝,而不是我從安裝說明中獲得的版本?

如果鍵入node所有的本身,它這樣說:

$ node 

events.js:72 
     throw er; // Unhandled 'error' event 
      ^
Error: read ENOTCONN 
    at errnoException (net.js:884:11) 
    at Socket._read (net.js:389:21) 
    at Socket.Readable.read (_stream_readable.js:320:10) 
    at Socket.read (net.js:291:43) 
    at new Socket (net.js:185:10) 
    at process.stdin (node.js:660:19) 
    at startup (node.js:145:16) 
    at node.js:901:3 
+1

沒有cygwin會給出相同的錯誤嗎? – user568109

+0

@ user568109是的,它的確如此。 –

+0

如果你自己輸入'node',會發生什麼? – user568109

回答

1

不幸的是,node no longer supports Cygwin

一種解決方法是使用某種MSysGit作爲控制檯而不是Cygwin,至少對於運行節點/ coffeescript。 Git Bash提供了一個很好的。你可以得到它here

相關問題