Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While trying to run I get this error: path.exists is now called fs.exists #88

Open
wavesailor opened this issue Aug 13, 2013 · 8 comments

Comments

@wavesailor
Copy link

While trying to run howtonode.org, I get this error:

path.exists is now called `fs.exists`

I'm new to node.js but I did a successful npm install. I'm running node.js v0.10.15 on ubuntu 12.04

Any ideas?

PS. the README.markdown has conflicting methods to run the server.

@nrstott
Copy link
Collaborator

nrstott commented Aug 13, 2013

Seems pretty straight-forward. path.exists has been changed to fs.exists
and that needs to be updated.

On Tue, Aug 13, 2013 at 11:18 AM, wavesailor [email protected]:

While trying to run howtonode.org, I get this error:

path.exists is now called fs.exists

I'm new to node.js but I did a successful npm install. I'm running node.js
v0.10.15 on ubuntu 12.04

Any ideas?

PS. the README.markdown has conflicting methods to run the server.


Reply to this email directly or view it on GitHubhttps://github.com//issues/88
.

@wavesailor
Copy link
Author

Hmmm ... okay so how do I fix it? I search through all the code and modules for path.exists is now called fs.exists`` but could not find anything.
The complete error messages are as follows:

$nodserver/server.js
path.exists is now called `fs.exists`.

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

With regards to running the code, does it have to reside in a specific directory and does it need a particular .host entry or environment variable set?

@nrstott
Copy link
Collaborator

nrstott commented Aug 14, 2013

Just find path.exists and replace it with fs.exists

On Wed, Aug 14, 2013 at 6:22 AM, wavesailor [email protected]:

Hmmm ... okay so how do I fix it? I search through all the code and
modules for path.exists is now called fs.exists but could not find
anything.
The complete error messages are as follows:

$nodserver/server.js
path.exists is now called fs.exists.

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

With regards to running the code, does it have to reside in a specific
directory and does it need a particular .host entry or environment variable
set?


Reply to this email directly or view it on GitHubhttps://github.com//issues/88#issuecomment-22628984
.

@wavesailor
Copy link
Author

Okay I replaced all the occurrences of path.exists with fs.exists but I'm still getting an error.


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)

I searched through all the code for throw er; but could not find any ???

@nrstott
Copy link
Collaborator

nrstott commented Aug 14, 2013

Its coming from events.js in node, that's why you're not finding it.
Somewhere there is a call to spawn that can not find the file it is trying
to run. That's what the ENOENT means.

As the stack trace ends in node.js code, I am not sure where your error is
coming from.

On Wed, Aug 14, 2013 at 11:28 AM, wavesailor [email protected]:

Okay I replaced all the occurrences of path.exists with fs.exists but I'm
still getting an error.

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)

I searched through all the code for throw er; but could not find any ???


Reply to this email directly or view it on GitHubhttps://github.com//issues/88#issuecomment-22648120
.

@wavesailor
Copy link
Author

Okay ... a little embarrassing - I didn't realise that howtonode.org, which uses the wheat module needed git to be installed :-( I'm guessing that was the spawn error. I'm running this on a new ubuntu machine

Are there any other dependencies I need as I now get further but have run into this error:

/home/wavesailor/howtonode.org-master/node_modules/wheat/node_modules/git-fs/lib/git-fs.js:208
      callback(err);
      ^
TypeError: undefined is not a function
    at ChildProcess.<anonymous> (/home/wavesailor/howtonode.org-master/node_modules/wheat/node_modules/git-fs/lib/git-fs.js:208:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

@b2k
Copy link

b2k commented May 22, 2017

I'm angry. I was just reading an article on OReiley called "what is node.js". It's first exercise is to read a file from disk. So I copied the code, and tried to run the webserver "node nodeFileServer.js". I get deprecation warnings and errors: "sys is deprecated. Use util instead" and "path.exists" is not a function.

A resulting search landed me here, were I see further issues with deprecated code, where not even the recommended replacements work. Furthermore, I find out that fs.exists is also deprecated and I'm supposed to use fs.stat, but only if I'm not checking for the existance of a file!

What's a noob supposed to do!!???

@kriskowal
Copy link
Collaborator

If you can’t beat them, join them. Volunteering to write and maintain documentation provides immeasurable value to the people who follow.

Thank you for sharing your feelings. It highlights the value of contributions in this area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants