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

Exception on startup if $PWD is deleted #1184

Closed
ghost opened this issue Mar 18, 2015 · 20 comments
Closed

Exception on startup if $PWD is deleted #1184

ghost opened this issue Mar 18, 2015 · 20 comments

Comments

@ghost
Copy link

ghost commented Mar 18, 2015

$ iojs
node.js:771
    var cwd = process.cwd();
                      ^
Error: ENOENT: no such file or directory, uv_cwd
    at Error (native)
    at Function.startup.resolveArgv0 (node.js:771:23)
    at startup (node.js:46:13)
    at node.js:865:3

No idea what any of this means besides "no such file or directory"; hopefully you experienced Node/IO devs will know what this means.

@mscdex
Copy link
Contributor

mscdex commented Mar 18, 2015

What iojs version and what platform are you on?

@ghost
Copy link
Author

ghost commented Mar 18, 2015

Just downloaded it, so 1.5.1 and Mac OS X 10.10(.3) Yosemite.

@mscdex mscdex added the confirmed-bug Issues with confirmed bugs. label Mar 18, 2015
@vkurchatkin
Copy link
Contributor

Don't think it is a bug. This happens when cwd is removed

@ghost
Copy link
Author

ghost commented Mar 18, 2015

I think that just running iojs should give me the same output as iojs --help. Just my opinion though.

@mscdex
Copy link
Contributor

mscdex commented Mar 18, 2015

@vkurchatkin Removed?

@julianduque
Copy link
Contributor

steps to reproduce:

(from term 1)
$ mkdir somedir
$ cd somedir
(from term 2)
$ rmdir somedir
(from term 1)
$ iojs
node.js:771
    var cwd = process.cwd();
                      ^
Error: ENOENT: no such file or directory, uv_cwd
    at Error (native)
    at Function.startup.resolveArgv0 (node.js:771:23)
    at startup (node.js:46:13)
    at node.js:865:3

@julianduque julianduque removed the confirmed-bug Issues with confirmed bugs. label Mar 18, 2015
@julianduque
Copy link
Contributor

Isn't a bug, the folder was removed from another process and cwd doesn't exist as @vkurchatkin said

@julianduque
Copy link
Contributor

@matrixdevuk executing iojs will open the REPL not the help

@ghost
Copy link
Author

ghost commented Mar 18, 2015

Ah, running it again fixed it. Thanks guys.

@mscdex mscdex closed this as completed Mar 18, 2015
@bnoordhuis
Copy link
Member

I'm going to reopen this and take a look. Throwing an error seems like a bad user experience.

@bnoordhuis bnoordhuis reopened this Mar 18, 2015
@bnoordhuis bnoordhuis changed the title Some weird error. Exception on startup if $PWD is deleted Mar 18, 2015
@silverwind
Copy link
Contributor

Simpler test:

mkdir testdir && cd testdir && (cd .. && rm testdir) && iojs; cd ..

@ghost
Copy link
Author

ghost commented Mar 18, 2015

You could probably just check if the directory in question exists, if not just say something like "Are you sure exists?".

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Mar 19, 2015
The current working directory may not exist when iojs starts up.  Don't
treat that as an error because it's still possible to do many useful
things, like evaluating a command line script or starting a REPL.

This commit also fixes an age-old Windows bug where process.argv[0] was
not properly expanded, that's why the parallel/test-process-argv-0 test
gets an update as well.

Fixes: nodejs#1184
PR-URL: nodejs#1194
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Mar 19, 2015
The current working directory may not exist when the REPL starts up.
Don't treat that as an error because it's still possible to do many
useful things.  This is like the previous commit but for the REPL.

Fixes: nodejs#1184
PR-URL: nodejs#1194
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
@bnoordhuis
Copy link
Member

Fixed in c15e81a...2b2e48a.

@mgol
Copy link
Contributor

mgol commented Oct 12, 2015

I've just seen an exact same error with Node.js 4.1.2.

@bnoordhuis
Copy link
Member

Can you file a new issue with steps on how to reproduce it? Do the regression tests from c15e81a...2b2e48a work for you locally?

@mgol
Copy link
Contributor

mgol commented Oct 12, 2015

The test/parallel/test-cwd-enoent.js test works fine for me.

I'll look into preparing an isolated test case.

@nicosommi
Copy link

@mzgol FYI today I experimented this same issue on node v4.2.2 and it was because I was running a script inside of an autogenerated directory which didn't exist anymore (or it was deleted and created again meanwhile, so it fails even if they exists under the same name, I guess it's maybe because of the i-node pointers).
A classic example will be to execute a script under your babel compiled source, etc.
A quick way to solve it is to go out to an existing directory and go back there.

@amadeobrands
Copy link

Strange had a similar problem restarted and problem is solved.

@pickworth
Copy link

I am getting this issue in the following scenario:

  • Running My node App
  • doing a gulp build which outputs to a build directory
  • trying to run the built node app while the the src node app is running

$ node -v
v5.5.0

@ramonGonzEdu
Copy link

I just had this issue when I deleted then git cloned a director, and ran the script.

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

10 participants