File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -352,22 +352,22 @@ If this was in a folder at `./some-library`, then
352352
353353This is the extent of Node.js's awareness of ` package.json ` files.
354354
355- If the file specified by the ` 'main' ` entry of ` package.json ` is missing and
356- can not be resolved, Node.js will report the entire module as missing with the
357- default error:
358-
359- ``` txt
360- Error: Cannot find module 'some-library'
361- ```
362-
363- If there is no ` package.json ` file present in the directory, then Node.js
355+ If there is no ` package.json ` file present in the directory, or if the
356+ ` 'main' ` entry is missing or cannot be resolved, then Node.js
364357will attempt to load an ` index.js ` or ` index.node ` file out of that
365358directory. For example, if there was no ` package.json ` file in the above
366359example, then ` require('./some-library') ` would attempt to load:
367360
368361* ` ./some-library/index.js `
369362* ` ./some-library/index.node `
370363
364+ If these attempts fail, then Node.js will report the entire module as missing
365+ with the default error:
366+
367+ ``` txt
368+ Error: Cannot find module 'some-library'
369+ ```
370+
371371## Loading from ` node_modules ` Folders
372372
373373<!-- type=misc-->
You can’t perform that action at this time.
0 commit comments