You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a directory contains a broken symlink at any level of its subdirectory tree, performing require-directoty() in it will always throw an ENOENT error.
For example, running index.js in the following tree:
├── dir
│ └── broken-subdir -> nonexistent
├── index.js
Where the contents of index.js is just require('require-directory')(module) will throw:
$ node index.js
fs.js:696
return binding.stat(pathModule._makeLong(path));
^
Error: ENOENT, no such file or directory '/Users/aleksey/require-directotry-test/dir/broken-subdir'
at Object.fs.statSync (fs.js:696:18)
at /Users/aleksey/require-directotry-test/node_modules/require-directory/index.js:65:12
at Array.forEach (native)
at requireDirectory (/Users/aleksey/require-directotry-test/node_modules/require-directory/index.js:59:24)
at /Users/aleksey/require-directotry-test/node_modules/require-directory/index.js:67:15
at Array.forEach (native)
at requireDirectory (/Users/aleksey/require-directotry-test/node_modules/require-directory/index.js:59:24)
at Object.<anonymous> (/Users/aleksey/require-directotry-test/index.js:1:91)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
I think it should still attempt to traverse and load the successful directories, and defer the error handling to the consumer.
The text was updated successfully, but these errors were encountered:
I've come across a similar error where it decides to get relative paths wrong - but using fs.resolve(path) on the path before handing it over fixes that before it gets here. It's only related in that the error could do with being in user-land. Didn't track down the "why" hence not opening a separate issue.
If a directory contains a broken symlink at any level of its subdirectory tree, performing
require-directoty()
in it will always throw an ENOENT error.For example, running
index.js
in the following tree:Where the contents of index.js is just
require('require-directory')(module)
will throw:I think it should still attempt to traverse and load the successful directories, and defer the error handling to the consumer.
The text was updated successfully, but these errors were encountered: