为什么我在cygwin中运行coffee命令时遇到错误? [英] Why am I getting errors running the coffee command in cygwin?

查看:379
本文介绍了为什么我在cygwin中运行coffee命令时遇到错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照 CoffeeScript安装指南安装了Node.js和 node- v0.10.9-x64.msi 安装程序。然后我启动一个cygwin控制台和 cd '到我的 .coffee 文件的目录。如果我自己键入咖啡,它会给我这个错误:

  $ coffee 
coffee>
event.js:72
throw er; //未处理的错误事件
^
错误:读取ENOTCONN
在errnoException(net.js:884:11)
在Socket._read(net.js:389:在Socket.read(net.js:291:43)
在Socket.Readable.read(_stream_readable.js:320:10)
在新的Socket(net.js: 185:10)
at process.stdin(node.js:660:19)
在新REPLServer(repl.js:132:15)
在Object.exports.start js:312:14)
at Object.module.exports.start(C:\Users\foo\AppData\Roaming\\\
pm\\\
ode_modules\coffee-script\lib\coffee -script\repl.js:106:23)
在Object.exports.run(C:\Users\foo\AppData\Roaming\\\
pm\\\
ode_modules\coffee-script\ lib \coffee-script\command.js:77:32)
at Object。< anonymous> (C:\Users\foo\AppData\Roaming\\\
pm\\\
ode_modules\coffee-script\bin\coffee:7:41)
在Module._compile(module.js: 456:26)
在Object.Module._extensions..js(module.js:474:10)
在Module.load(module.js:356:32)
在函数。 Module._load(module.js:312:12)
在Function.Module.runMain(module.js:497:10)
启动时(node.js:119:16)
at node.js:901:3

如果我使用 -lw 它给我这个错误:

  $ coffee -lw Example.js.coffee 
错误:此套接字已关闭。
at socket._write(net.js:618:19)
at doWrite(_stream_writable.js:219:10)
at writeOrBuffer(_stream_writable.js:209:5)
在Socket.write(_stream_writable.js:180:11)
在Socket.write(net.js:596:40)
at lint(C:\Users \foo \ AppData \Roaming\\\
pm\\\
ode_modules\coffee-script\lib\coffee-script\command.js:468:15)
在compileScript(C:\Users \foo \ AppData\Roaming\\\
pm\\\
ode_modules\coffee-script\lib\coffee-script\command.js:193:18)
at C:\Users\foo\AppData\\ \\Roaming\\\
pm\\\
ode_modules\coffee-script\lib\coffee-script\command.js:144:18
at fs.js:266:14
在Object.oncomplete (fs.js:107:15)

event.js:72
throw er; //未处理的错误事件
^
错误:在Process.ChildProcess._handle.onexit(child_process。)处错误:spawn ENOENT
at errnoException(child_process.js:980:11)
。 js:771:34)

如果我只使用 -l 选项它给我这个错误:

  $ coffee -l Example.coffee 
错误:此插座已关闭。
at socket._write(net.js:618:19)
at doWrite(_stream_writable.js:219:10)
at writeOrBuffer(_stream_writable.js:209:5)
在Socket.write(_stream_writable.js:180:11)
在Socket.write(net.js:596:40)
at lint(C:\Users \foo \ AppData \Roaming\\\
pm\\\
ode_modules\coffee-script\lib\coffee-script\command.js:468:15)
在compileScript(C:\Users \foo \ AppData\Roaming\\\
pm\\\
ode_modules\coffee-script\lib\coffee-script\command.js:193:18)
at C:\Users\foo\AppData\\ \\Roaming\\\
pm\\\
ode_modules\coffee-script\lib\coffee-script\command.js:144:18
at fs.js:266:14
在Object.oncomplete (fs.js:107:15)

但似乎我可以编译和/没有lint选项和事情按预期工作。



我不知道任何关于Node.js.我试图googling这些错误,我看到类似的相关的端口在使用和套接字问题。我认为可能有用的是注意到,我使用Intellij IDEA(一个IDE),它有一个CoffeeScript插件,也许是干扰。但是当我关闭Intellij我仍然得到这些相同的错误,所以可能是一个红色的鲱鱼。



此外,也许有一个特定的cygwin版本的node.js我应该安装,而不是我从安装说明中得到的?



如果我自己键入节点,则表示:

  $ node 

events.js:72
throw //未处理的错误事件
^
错误:读取ENOTCONN
在errnoException(net.js:884:11)
在Socket._read(net.js:389:在Socket.read(net.js:291:43)
在Socket.Readable.read(_stream_readable.js:320:10)
在新的Socket(net.js: 185:10)
at process.stdin(node.js:660:19)
启动时(node.js:145:16)
在node.js:901:3 $ b不幸的是, com / joyent / node / wiki /安装#build-on-cygwinrel =nofollow>节点不再支持Cygwin



使用一些种类的MSysGit作为控制台而不是Cygwin,至少对于运行node / coffeescript。 Git Bash提供了一个好的。您可以在此查看。


I followed the CoffeeScript installation guide by installing Node.js with the node-v0.10.9-x64.msi installer. I then started up a cygwin console and cd'd into the directory with my .coffee file. If I type coffee all by itself, it gives me this error:

$ 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

And if I run the command with -lw it gives me this error:

$ 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)

And if I run with just the -l option it gives me this error:

$ 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)

But it seems like I can compile and/or watch option without the lint option and things work as expected.

I don't know anything about Node.js. I've tried googling these errors and I see similar ones related to ports in use and socket issues. I think it might be useful to note that I'm using Intellij IDEA (an IDE) and it has a CoffeeScript plugin which perhaps is interfering. But when I turn Intellij off I still get these same errors so that might be a red herring.

Also, perhaps there's a specific cygwin version of node.js I should have installed instead of the one I got from the installation instructions?

If I type node all by itself, it says this:

$ 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

解决方案

Unfortunately, node no longer supports Cygwin.

One workaround is to use some variety of MSysGit as a console instead of Cygwin, at least for running node/coffeescript. Git Bash supplies a good one. You can get it here.

这篇关于为什么我在cygwin中运行coffee命令时遇到错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆