-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
process: improve process.cwd() error message #61164
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61164 +/- ##
=======================================
Coverage 88.53% 88.53%
=======================================
Files 703 703
Lines 208599 208605 +6
Branches 40229 40229
=======================================
+ Hits 184685 184695 +10
+ Misses 15939 15935 -4
Partials 7975 7975
🚀 New features to boost your workflow:
|
4df8170 to
6dfc827
Compare
|
@theanarkh @joyeecheung Please trigger the ci to check again. |
|
@joyeecheung @legendecas @Qard @theanarkh Pls code review this pr |
|
My thinking with reporting the issue initially was that we could provide a bit more expanded context explaining what the cause could be, like stating that the current working directory was likely removed without changing the working directory to something else. It's already I think obvious enough that the error is coming from a |
@Qard So, would changing the error message to "ENOENT: process.cwd failed with error no such file or directory, the current working directory was likely removed without changing the working directory, uv_cwd" achieve it? |
|
That sounds reasonable to me. 🙂 |
Got it. I will commit it soon. |
|
@Qard Hi, I have committed it. Please have a code review for it, and if there is no issue please trigger the CI to check again. |
|
@Qard If you have time, please help trigger a CI to check and review the pr. Thank you very much😊. |
Failed to start CI⚠ Commits were pushed since the last approving review: ⚠ - process: improve process.cwd() error message ⚠ - process: add notice message when process.cwd() failed. ⚠ - process: fix cpp format issue ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/20535988465 |
|
@Qard Sorry to bother you again. The CI checks for the cpp format failed. My bad. I have fixed the issue. Could you please trigger the CI to check and CR again? |
@addaleax It is confusing that the three ci actions are pending in running status for 2 days. Could you please help to trigger it again? |
10b8991 to
1030646
Compare
Commit Queue failed- Loading data for nodejs/node/pull/61164 ✔ Done loading data for nodejs/node/pull/61164 ----------------------------------- PR info ------------------------------------ Title process: improve process.cwd() error message (#61164) Author TseIan <tseianxwc@gmail.com> (@Tseian, first-time contributor) Branch Tseian:improve-err-msg -> nodejs:main Labels c++, author ready Commits 6 - process: improve process.cwd() error message - process: add notice message when process.cwd() failed. - process: fix cpp format issue - process: fix cpp format issue - process: remove std::string - process: format cpp Committers 1 - TseIan <tseianxwc@gmail.com> PR-URL: https://github.com/nodejs/node/pull/61164 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: theanarkh <theratliter@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/61164 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: theanarkh <theratliter@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> -------------------------------------------------------------------------------- ℹ This PR was created on Wed, 24 Dec 2025 04:43:35 GMT ✔ Approvals: 3 ✔ - Stephen Belanger (@Qard): https://github.com/nodejs/node/pull/61164#pullrequestreview-3617532299 ✔ - theanarkh (@theanarkh): https://github.com/nodejs/node/pull/61164#pullrequestreview-3618787231 ✔ - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/61164#pullrequestreview-3614923158 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2025-12-30T08:14:48Z: https://ci.nodejs.org/job/node-test-pull-request/70629/ - Querying data for job/node-test-pull-request/70629/ ✔ Build data downloaded ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ No git cherry-pick in progress ✔ No git am in progress ✔ No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD ✔ origin/main is now up-to-date - Downloading patch for 61164 From https://github.com/nodejs/node * branch refs/pull/61164/merge -> FETCH_HEAD ✔ Fetched commits as d991f690df76..752b571ee1a2 -------------------------------------------------------------------------------- [main 49ab8a6ebf] process: improve process.cwd() error message Author: TseIan <tseianxwc@gmail.com> Date: Sun Dec 21 18:38:29 2025 +0800 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 test/parallel/test-cwd-enoent-improved-message.js [main 5099f164f5] process: add notice message when process.cwd() failed. Author: TseIan <tseianxwc@gmail.com> Date: Fri Dec 26 08:02:11 2025 +0800 3 files changed, 12 insertions(+), 4 deletions(-) [main e0a9fc028d] process: fix cpp format issue Author: TseIan <tseianxwc@gmail.com> Date: Sat Dec 27 08:34:31 2025 +0800 1 file changed, 1 insertion(+), 1 deletion(-) [main bcb5f57734] process: fix cpp format issue Author: TseIan <tseianxwc@gmail.com> Date: Sat Dec 27 17:16:37 2025 +0800 1 file changed, 2 insertions(+), 1 deletion(-) [main e792c1253f] process: remove std::string Author: TseIan <tseianxwc@gmail.com> Date: Mon Dec 29 21:32:01 2025 +0800 1 file changed, 2 insertions(+), 2 deletions(-) [main db0c830e2c] process: format cpp Author: TseIan <tseianxwc@gmail.com> Date: Mon Dec 29 23:06:34 2025 +0800 1 file changed, 3 insertions(+), 4 deletions(-) ✔ Patches applied There are 6 commits in the PR. Attempting autorebase. (node:2682) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated. (Use `node --trace-deprecation ...` to show where the warning was created) Rebasing (2/12) Executing: git node land --amend --yes --------------------------------- New Message ---------------------------------- process: improve process.cwd() error messagehttps://github.com/nodejs/node/actions/runs/20639737695 |
|
Landed in 3518af0 |

Issue
#57045
Description
Improves the error message when process.cwd() failed by adding prefix err message 'process.cwd failed with error' if call uv_cwd failed
Before
Error: ENOENT: no such file or directory, uv_cwd
After
ENOENT: process.cwd failed with error no such file or directory, the current working directory was likely removed without changing the working directory, uv_cwd
Changes
Test