Skip to content

Commit

Permalink
doc: fix documentation for MODULE_NOT_FOUND and ERR_MODULE_NOT_FOUND
Browse files Browse the repository at this point in the history
PR-URL: #41645
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
aduh95 authored and ruyadorno committed Feb 7, 2022
1 parent 2cae994 commit 2bba6cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -2225,9 +2225,8 @@ transferable object types has been expanded to cover more types than

### `ERR_MODULE_NOT_FOUND`

> Stability: 1 - Experimental
An [ES Module][] could not be resolved.
A module file could not be resolved by the ECMAScript modules loader while
attempting an `import` operation or when loading the program entry point.

<a id="ERR_MULTIPLE_CALLBACK"></a>

Expand Down Expand Up @@ -2958,8 +2957,8 @@ changes:
description: Added `requireStack` property.
-->

A module file could not be resolved while attempting a [`require()`][] or
`import` operation.
A module file could not be resolved by the CommonJS modules loader while
attempting a [`require()`][] operation or when loading the program entry point.

## Legacy Node.js error codes

Expand Down
6 changes: 3 additions & 3 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ A required module prefixed with `'./'` is relative to the file calling
Without a leading `'/'`, `'./'`, or `'../'` to indicate a file, the module must
either be a core module or is loaded from a `node_modules` folder.

If the given path does not exist, `require()` will throw an [`Error`][] with its
`code` property set to `'MODULE_NOT_FOUND'`.
If the given path does not exist, `require()` will throw a
[`MODULE_NOT_FOUND`][] error.

## Folders as modules

Expand Down Expand Up @@ -1084,7 +1084,7 @@ This section was moved to
[`"type"`]: packages.md#type
[`ERR_REQUIRE_ESM`]: errors.md#err_require_esm
[`ERR_UNSUPPORTED_DIR_IMPORT`]: errors.md#err_unsupported_dir_import
[`Error`]: errors.md#class-error
[`MODULE_NOT_FOUND`]: errors.md#module_not_found
[`__dirname`]: #__dirname
[`__filename`]: #__filename
[`import()`]: https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports
Expand Down

0 comments on commit 2bba6cd

Please sign in to comment.