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

doc: fix documentation for MODULE_NOT_FOUND and ERR_MODULE_NOT_FOUND #41645

Merged
merged 1 commit into from
Jan 24, 2022

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Jan 22, 2022

ERR_MODULE_NOT_FOUND was still marked as experimental, probably an oversight from #35781.
ERR_MODULE_NOT_FOUND is thrown wether the target specifier would be an ES module or not (we cannot really know the format of a file that doesn't exist anyway).
I've added a note regarding which module loader is involved (sorry @GeoffreyBooth), which is unfortunate but I didn't know how to explain the difference otherwise.

Repro snippets
$ node /nope
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/nope'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v17.4.0
$ node -e 'require("/nope")'
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/nope'
Require stack:
- …/[eval]
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at [eval]:1:1
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:305:38)
    at node:internal/process/execution:75:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:74:60) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '…/[eval]' ]
}

Node.js v17.4.0
$ node --input-type=module -e 'import"/nope"'
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/nope' imported from …/[eval1]
    at new NodeError (node:internal/errors:371:5)
    at finalizeResolution (node:internal/modules/esm/resolve:394:11)
    at moduleResolve (node:internal/modules/esm/resolve:944:10)
    at defaultResolve (node:internal/modules/esm/resolve:1041:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v17.4.0
$ node --experimental-specifier-resolution=node /nope
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/nope' imported from …
    at new NodeError (node:internal/errors:371:5)
    at finalizeResolution (node:internal/modules/esm/resolve:383:11)
    at moduleResolve (node:internal/modules/esm/resolve:944:10)
    at defaultResolve (node:internal/modules/esm/resolve:1041:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
    at ESMLoader.import (node:internal/modules/esm/loader:332:22)
    at node:internal/modules/run_main:54:28
    at loadESM (node:internal/process/esm_loader:88:11)
    at async handleMainPromise (node:internal/modules/run_main:61:12) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v17.4.0
$ node --input-type=module -e 'import("/nope").catch(console.error)'
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/nope' imported from …/[eval1]
    at new NodeError (node:internal/errors:371:5)
    at finalizeResolution (node:internal/modules/esm/resolve:394:11)
    at moduleResolve (node:internal/modules/esm/resolve:944:10)
    at defaultResolve (node:internal/modules/esm/resolve:1041:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
    at ESMLoader.import (node:internal/modules/esm/loader:332:22)
    at importModuleDynamically (node:internal/modules/esm/loader:213:29)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
    at file://…/[eval1]:1:1 {
  code: 'ERR_MODULE_NOT_FOUND'
}
$ node --input-type=commonjs -e 'import("/nope").catch(console.error)'
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/nope' imported from …/[eval]
    at new NodeError (node:internal/errors:371:5)
    at finalizeResolution (node:internal/modules/esm/resolve:394:11)
    at moduleResolve (node:internal/modules/esm/resolve:944:10)
    at defaultResolve (node:internal/modules/esm/resolve:1041:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
    at ESMLoader.import (node:internal/modules/esm/loader:332:22)
    at importModuleDynamically (node:internal/process/execution:81:29)
    at importModuleDynamicallyWrapper (node:internal/vm/module:437:21)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) {
  code: 'ERR_MODULE_NOT_FOUND'
}

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/modules

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Jan 22, 2022
@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 22, 2022
@targos targos added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 24, 2022
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jan 24, 2022
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/41645
✔  Done loading data for nodejs/node/pull/41645
----------------------------------- PR info ------------------------------------
Title      doc: fix documentation for `MODULE_NOT_FOUND` and `ERR_MODULE_NOT_FOUND` (#41645)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     aduh95:module-not-found-error-doc -> nodejs:master
Labels     doc, author ready
Commits    1
 - doc: fix documentation for `MODULE_NOT_FOUND` and `ERR_MODULE_NOT_FOUND`
Committers 1
 - Antoine du Hamel 
PR-URL: https://github.com/nodejs/node/pull/41645
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/383:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Reviewed-By: Guy Bedford 
Reviewed-By: Geoffrey Booth 
Reviewed-By: Rich Trott 
Reviewed-By: Luigi Pinca 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/41645
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/383:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Reviewed-By: Guy Bedford 
Reviewed-By: Geoffrey Booth 
Reviewed-By: Rich Trott 
Reviewed-By: Luigi Pinca 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Sat, 22 Jan 2022 10:41:58 GMT
   ✔  Approvals: 4
   ✔  - Guy Bedford (@guybedford): https://github.com/nodejs/node/pull/41645#pullrequestreview-860194312
   ✔  - Geoffrey Booth (@GeoffreyBooth): https://github.com/nodejs/node/pull/41645#pullrequestreview-860227747
   ✔  - Rich Trott (@Trott) (TSC): https://github.com/nodejs/node/pull/41645#pullrequestreview-860232926
   ✔  - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/41645#pullrequestreview-860235952
   ✔  Last GitHub CI successful
   ℹ  Green GitHub CI is sufficient
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/master up to date...
From https://github.com/nodejs/node
 * branch                  master     -> FETCH_HEAD
✔  origin/master is now up-to-date
- Downloading patch for 41645
From https://github.com/nodejs/node
 * branch                  refs/pull/41645/merge -> FETCH_HEAD
✔  Fetched commits as c0ef0d5a66e0..9646e1ac4c25
--------------------------------------------------------------------------------
[master aee2e45647] doc: fix documentation for `MODULE_NOT_FOUND` and `ERR_MODULE_NOT_FOUND`
 Author: Antoine du Hamel 
 Date: Sat Jan 22 11:26:31 2022 +0100
 2 files changed, 7 insertions(+), 8 deletions(-)
   ✔  Patches applied
--------------------------------------------------------------------------------
--------------------------------- New Message ----------------------------------
doc: fix documentation for `MODULE_NOT_FOUND` and `ERR_MODULE_NOT_FOUND`

PR-URL: #41645
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/383:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Reviewed-By: Guy Bedford guybedford@gmail.com
Reviewed-By: Geoffrey Booth webadmin@geoffreybooth.com
Reviewed-By: Rich Trott rtrott@gmail.com
Reviewed-By: Luigi Pinca luigipinca@gmail.com

[master 71d035794f] doc: fix documentation for MODULE_NOT_FOUND and ERR_MODULE_NOT_FOUND
Author: Antoine du Hamel duhamelantoine1995@gmail.com
Date: Sat Jan 22 11:26:31 2022 +0100
2 files changed, 7 insertions(+), 8 deletions(-)
✖ 71d035794fce5d34628c1de6cef7300a8adeb146
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
⚠ 0:50 Title should be <= 50 columns. title-length
✔ 1:8 PR-URL is valid. pr-url
✖ 2:7 Fixes must be a GitHub URL. fixes-url
✖ 2:7 Fixes must be a GitHub URL. fixes-url
✖ 2:7 Fixes must be a GitHub URL. fixes-url
✖ 3:7 Fixes must be a GitHub URL. fixes-url
✖ 3:7 Fixes must be a GitHub URL. fixes-url
✖ 3:7 Fixes must be a GitHub URL. fixes-url
✖ 3:7 Fixes must be a GitHub URL. fixes-url
✖ 4:7 Fixes must be a GitHub URL. fixes-url
✖ 4:7 Fixes must be a GitHub URL. fixes-url
✖ 4:7 Fixes must be a GitHub URL. fixes-url
✖ 4:7 Fixes must be a GitHub URL. fixes-url
✖ 5:7 Fixes must be a GitHub URL. fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
ℹ Please fix the commit message and try again.

https://github.com/nodejs/node/actions/runs/1740375907

@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/41645
✔  Done loading data for nodejs/node/pull/41645
----------------------------------- PR info ------------------------------------
Title      doc: fix documentation for `MODULE_NOT_FOUND` and `ERR_MODULE_NOT_FOUND` (#41645)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     aduh95:module-not-found-error-doc -> nodejs:master
Labels     doc, author ready, commit-queue-failed
Commits    1
 - doc: fix documentation for `MODULE_NOT_FOUND` and `ERR_MODULE_NOT_FOUND`
Committers 1
 - Antoine du Hamel 
PR-URL: https://github.com/nodejs/node/pull/41645
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/383:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Reviewed-By: Guy Bedford 
Reviewed-By: Geoffrey Booth 
Reviewed-By: Rich Trott 
Reviewed-By: Luigi Pinca 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/41645
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/383:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Reviewed-By: Guy Bedford 
Reviewed-By: Geoffrey Booth 
Reviewed-By: Rich Trott 
Reviewed-By: Luigi Pinca 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Sat, 22 Jan 2022 10:41:58 GMT
   ✔  Approvals: 4
   ✔  - Guy Bedford (@guybedford): https://github.com/nodejs/node/pull/41645#pullrequestreview-860194312
   ✔  - Geoffrey Booth (@GeoffreyBooth): https://github.com/nodejs/node/pull/41645#pullrequestreview-860227747
   ✔  - Rich Trott (@Trott) (TSC): https://github.com/nodejs/node/pull/41645#pullrequestreview-860232926
   ✔  - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/41645#pullrequestreview-860235952
   ✔  Last GitHub CI successful
   ℹ  Green GitHub CI is sufficient
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/master up to date...
From https://github.com/nodejs/node
 * branch                  master     -> FETCH_HEAD
✔  origin/master is now up-to-date
- Downloading patch for 41645
From https://github.com/nodejs/node
 * branch                  refs/pull/41645/merge -> FETCH_HEAD
✔  Fetched commits as 3ee8c3e45e5f..9646e1ac4c25
--------------------------------------------------------------------------------
[master 0545239eed] doc: fix documentation for `MODULE_NOT_FOUND` and `ERR_MODULE_NOT_FOUND`
 Author: Antoine du Hamel 
 Date: Sat Jan 22 11:26:31 2022 +0100
 2 files changed, 7 insertions(+), 8 deletions(-)
   ✔  Patches applied
--------------------------------------------------------------------------------
--------------------------------- New Message ----------------------------------
doc: fix documentation for `MODULE_NOT_FOUND` and `ERR_MODULE_NOT_FOUND`

PR-URL: #41645
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/383:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Fixes: https://github.com/394:11)
Fixes: https://github.com/944:10)
Fixes: https://github.com/1041:11)
Reviewed-By: Guy Bedford guybedford@gmail.com
Reviewed-By: Geoffrey Booth webadmin@geoffreybooth.com
Reviewed-By: Rich Trott rtrott@gmail.com
Reviewed-By: Luigi Pinca luigipinca@gmail.com

[master fcfa46e6e2] doc: fix documentation for MODULE_NOT_FOUND and ERR_MODULE_NOT_FOUND
Author: Antoine du Hamel duhamelantoine1995@gmail.com
Date: Sat Jan 22 11:26:31 2022 +0100
2 files changed, 7 insertions(+), 8 deletions(-)
✖ fcfa46e6e25f23f21d57c7923bd1e3422fabb171
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
⚠ 0:50 Title should be <= 50 columns. title-length
✔ 1:8 PR-URL is valid. pr-url
✖ 2:7 Fixes must be a GitHub URL. fixes-url
✖ 2:7 Fixes must be a GitHub URL. fixes-url
✖ 2:7 Fixes must be a GitHub URL. fixes-url
✖ 3:7 Fixes must be a GitHub URL. fixes-url
✖ 3:7 Fixes must be a GitHub URL. fixes-url
✖ 3:7 Fixes must be a GitHub URL. fixes-url
✖ 3:7 Fixes must be a GitHub URL. fixes-url
✖ 4:7 Fixes must be a GitHub URL. fixes-url
✖ 4:7 Fixes must be a GitHub URL. fixes-url
✖ 4:7 Fixes must be a GitHub URL. fixes-url
✖ 4:7 Fixes must be a GitHub URL. fixes-url
✖ 5:7 Fixes must be a GitHub URL. fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
ℹ Please fix the commit message and try again.

https://github.com/nodejs/node/actions/runs/1740412607

@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jan 24, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 24, 2022
@nodejs-github-bot nodejs-github-bot merged commit 5d88f59 into nodejs:master Jan 24, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in 5d88f59

@aduh95 aduh95 deleted the module-not-found-error-doc branch January 24, 2022 22:00
Linkgoron pushed a commit to Linkgoron/node that referenced this pull request Jan 31, 2022
PR-URL: nodejs#41645
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
ruyadorno pushed a commit that referenced this pull request Feb 8, 2022
PR-URL: #41645
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 2, 2022
PR-URL: #41645
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41645
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 14, 2022
PR-URL: #41645
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants