5

I got a following error when I tried to watch coffee scripts by coffee -o js -cw coffee.

/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:321
        throw e;
              ^
Error: watch Unknown system errno 28
    at errnoException (fs.js:636:11)
    at FSWatcher.start (fs.js:663:11)
    at Object.watch (fs.js:691:11)
    at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:287:27
    at Object.oncomplete (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:100:11)

I have no idea what is going with error.

Then I checked the versions, coffee -v is 1.6.1 and node -v is v0.6.12.

According the official site( http://coffeescript.org/ ) the latest version is 1.6.3, so I wanted update coffee by npm update -g coffee-script, but this fails also.

npm WARN coffee-script@1.6.1 package.json: bugs['name'] should probably be bugs['url']
npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/coffee-script

How can I update coffee script?

Edit 2013/10/11

In my coffee script directory there is only one file box_wrapper.coffee.

$ ->
  $("body").children().wrap ->
    "<div id='#{$(@).attr "id"}_box' class='wrapper'/>"

Edit 2013/10/16

I tried to re-install coffee, so I've done like this.

$ sudo npm -g rm coffee
npm WARN Not installed in /usr/local/lib/node_modules coffee
$ coffee -v
CoffeeScript version 1.6.1

I can't remove coffee. And I tried also like this.

$ sudo apt-get remove npm
$ npm -v
-bash: /usr/bin/npm: No such file or directory
$ sudo apt-get install npm
$ npm -v
1.1.4
$ sudo npm -g install coffee

# I omit a lot of `GET` parts.

npm http 304 https://registry.npmjs.org/mkdirp/0.3.4
npm ERR! error installing express@3.2.6
npm http 304 https://registry.npmjs.org/assertion-error/1.0.0
npm http 304 https://registry.npmjs.org/growl
npm http 304 https://registry.npmjs.org/jade/0.26.3
npm http 304 https://registry.npmjs.org/diff/1.0.2
npm http 304 https://registry.npmjs.org/mkdirp/0.3.5
npm http 304 https://registry.npmjs.org/glob/3.2.1
npm http 304 https://registry.npmjs.org/ms/0.3.0
npm ERR! error rolling back express@3.2.6 Error: UNKNOWN, unknown error '/usr/local/lib/node_modules/coffee/node_modules/express'
npm ERR! error installing coffee@0.0.1

npm ERR! EEXIST, file already exists '/usr/local/lib/node_modules/coffee/node_modules/mocha/node_modules'
npm ERR! File exists: /usr/local/lib/node_modules/coffee/node_modules/mocha/node_modules
npm ERR! Move it away, and try again.
npm ERR! 
npm ERR! System Linux 3.2.0-54-generic-pae
npm ERR! command "node" "/usr/bin/npm" "-g" "install" "coffee"
npm ERR! cwd /home/ironsand
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! path /usr/local/lib/node_modules/coffee/node_modules/mocha/node_modules
npm ERR! fstream_path /usr/local/lib/node_modules/coffee/node_modules/mocha/node_modules/___debug.npm
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EEXIST
npm ERR! message EEXIST, file already exists '/usr/local/lib/node_modules/coffee/node_modules/mocha/node_modules'
npm ERR! errno {}
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:161:23
npm ERR! fstream_stack Object.oncomplete (/usr/lib/nodejs/mkdirp.js:34:53)

npm ERR! EEXIST, file already exists '/usr/local/lib/node_modules/coffee/node_modules/mocha/node_modules'
npm ERR! File exists: /usr/local/lib/node_modules/coffee/node_modules/mocha/node_modules
npm ERR! Move it away, and try again.
npm ERR! 
npm ERR! System Linux 3.2.0-54-generic-pae
npm ERR! command "node" "/usr/bin/npm" "-g" "install" "coffee"
npm ERR! cwd /home/ironsand
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! path /usr/local/lib/node_modules/coffee/node_modules/mocha/node_modules
npm ERR! fstream_path /usr/local/lib/node_modules/coffee/node_modules/mocha/node_modules/___debug.npm
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EEXIST
npm ERR! message EEXIST, file already exists '/usr/local/lib/node_modules/coffee/node_modules/mocha/node_modules'
npm ERR! errno {}
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:161:23
npm ERR! fstream_stack Object.oncomplete (/usr/lib/nodejs/mkdirp.js:34:53)
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ironsand/npm-debug.log
npm not ok

And npm-debug.log is a blank file.

ironsand
  • 1,137
  • 4
  • 12
  • 25

2 Answers2

5

The thing is that the npmjs repositories doesn't have the 1.6.3 but the 1.6.1. I will presume here, but the reason of your error is with your code, not CoffeeScript:

    } catch (e) {
      if (e.code !== 'ENOENT') {
        throw e;
      }
    }
  };

The above indicates that if e.code isn't exactly the same as ENOENT then throw the error, which in your case is:

Error: watch Unknown system errno 28
    at errnoException (fs.js:636:11)
    at FSWatcher.start (fs.js:663:11)
    at Object.watch (fs.js:691:11)
    at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:287:27
    at Object.oncomplete (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:100:11)

I would check the file fs.js and/or reverting the last changes you did to your code. CoffeScript is doing just fine, the problem is elsewhere.


For people that might actually update their CoffeScript

If you really want to use the latest CoffeScript, then the method to install it is using:

npm install -g http://github.com/jashkenas/coffee-script/tarball/master

This will install the latest CoffeScript, if you want the 1.6.3 version then you should use:

npm install -g http://github.com/jashkenas/coffee-script/tarball/1.6.3

Replace the 1.6.3 with the version of CoffeScript you like.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • Thanks for your Answer! But I never touched fs.js, and I don't even know where is it. I searched the file by locate "fs.js", but it appears only *-refs.js or *-defs.js, there is no "fs.js" file. What should I next to solve this problem? – ironsand Oct 11 '13 at 08:59
  • Just to make certain, I added information about my coffee script. – ironsand Oct 11 '13 at 09:00
  • As far as I know, I've not touched any coffee script files. I installed coffee and am using default setting. I've never even try to change settings. I'm create a folder ~/Dropbox/www/mysite and cd to the direcotory and a index.html file, and create js and coffee directries. After that copy some .js files to js directory that I use and create box_wrapper.coffee in coffee directory. – ironsand Oct 11 '13 at 12:26
  • And do coffee -o js -cw coffee, then I got the error. – ironsand Oct 11 '13 at 12:28
  • I've done same thing again in my home directory. But error message is same. – ironsand Oct 14 '13 at 18:21
  • I noticed coffee -v show version of coffee, but coffee shows error message node.js:201 throw e; // process.nextTick error, or 'error' event on first tick and more. – ironsand Oct 14 '13 at 18:22
  • I tried to remove npm and coffeescript completely, but I couldn't find the way to do it. I added info into my question. – ironsand Oct 15 '13 at 19:53
5

The error occurs because of old nodejs version. Ubuntu 12.04, 13.04 default nodejs package is version 0.6.x.

I updated nodejs version to v0.10.20 like this, then the problem is solved.

sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

I followed the instruction from here. https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

ironsand
  • 1,137
  • 4
  • 12
  • 25