DTrejo / run.js

Reruns the given node.js file whenever there's a change in the current directory — avoid alt-tabbing to restart your code

Home Page:https://dtrejo.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

symlink to nonexistent file causes run.js to exit

cam-intel opened this issue · comments

commented

when installing the current version of html5 () via npm, one of the files in the tree is a symlink to a nonexistent file.

this causes run.js to fall over:

node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ENOENT, No such file or directory './node_modules/html5/doc/index.html'
at Object.statSync (fs.js:400:18)
at /home/joe/local/node/lib/node_modules/run/run.js:63:19
at Array.forEach (native)
at parseFolder (/home/joe/local/node/lib/node_modules/run/run.js:61:9)
at /home/joe/local/node/lib/node_modules/run/run.js:72:34
at Array.forEach (native)
at parseFolder (/home/joe/local/node/lib/node_modules/run/run.js:61:9)
at /home/joe/local/node/lib/node_modules/run/run.js:72:34
at Array.forEach (native)
at parseFolder (/home/joe/local/node/lib/node_modules/run/run.js:61:9)

i guess a bit of error handling could cover this case, but maybe with a warning?

i've reported the issue to the html5 guys too.

Hmm.. I've never tried to use run.js with symlinks.
I'll take a look at this and try to reproduce on friday night.
If you get anywhere with fixing the problem, patches / pull requests are
welcome :)

On Wed, May 4, 2011 at 6:35 AM, cam-intel <
reply@reply.github.com>wrote:

when installing the current version of html5 () via npm, one of the files
in the tree is a symlink to a nonexistent file.

this causes run.js to fall over:

node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ENOENT, No such file or directory
'./node_modules/html5/doc/index.html'
at Object.statSync (fs.js:400:18)
at /home/joe/local/node/lib/node_modules/run/run.js:63:19
at Array.forEach (native)
at parseFolder (/home/joe/local/node/lib/node_modules/run/run.js:61:9)
at /home/joe/local/node/lib/node_modules/run/run.js:72:34
at Array.forEach (native)
at parseFolder (/home/joe/local/node/lib/node_modules/run/run.js:61:9)
at /home/joe/local/node/lib/node_modules/run/run.js:72:34
at Array.forEach (native)
at parseFolder (/home/joe/local/node/lib/node_modules/run/run.js:61:9)

i guess a bit of error handling could cover this case, but maybe with a
warning?

i've reported the issue to the html5 guys too.

Reply to this email directly or view it on GitHub:
#3

My indie music project, mixest.com
for more projects, dtrejo.com

Hi, I get the same kind of error.

node.js:181
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ENOENT, No such file or directory './lib64/udev/devices/sndstat'
at Object.statSync (fs.js:400:18)
at /root/local/node/lib/node_modules/run/run.js:69:19
at Array.forEach (native)
at parseFolder (/root/local/node/lib/node_modules/run/run.js:67:9)
at /root/local/node/lib/node_modules/run/run.js:78:34
at Array.forEach (native)
at parseFolder (/root/local/node/lib/node_modules/run/run.js:67:9)
at /root/local/node/lib/node_modules/run/run.js:78:34
at Array.forEach (native)
at parseFolder (/root/local/node/lib/node_modules/run/run.js:67:9)

Don't ask me what it's about, I don't have a clue, I'm just bringing it to your attention as it may be helping in any way.

I'm a total linux noob and I feel like the sorcerer's apprentice when dealing with it.

If you think you may have a solution to this, let me know, because I'm pissed having to restart the service every time I edit server.js ^^

Cheers and thanks for your work

Ah, forgot to work on it last friday :|

OSteEL, it seems like you are running your server somewhere in the root of your machine?

It is a good idea to run your server's file from inside your project directory, e.g.

cd projectdir
runjs server.js

projectdir/
    - server.js
    - index.html
    - etc

runjs tries to watch every file in the current directory and in any subdirectories, so in the case above it is trying to watch a device, b/c on macs and linux machines the device is represented as a file. If this is a bit confusing, just ignore my attempt at an explanation and make sure that you always use runjs in the same directory as your project.

Hopefully this helps,
D

I think I get it, and it works! thanks a lot.

And don't worry about forgetting to work on friday nights (even if it wasn't about my issue), beer is sometimes stronger than code ;)

I still need to address the symlink problem addressed by @cam-intel (if you added a fix, please feel free to submit a pull request :)

Will take a look at this later in the week, time permitting.