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
{{ message }}
Repository navigation
module resolution can fail with trailing slash #6214
Platform: Linux 4.5.0-302.fc24.x86_64 deps: update openssl to 1.0.1j #1 SMP Wed Mar 30 15:41:34 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Subsystem: module
I discovered this bug while trying to run pm2 with v6.0.0-rc.2.
To repro, create the following directory structure:
test
test/test.js
test/node_modules/a/package.json
test/test.js:
require('a/');
test/node_modules/a/package.json:
{
"main": "doesnotexist"
}
Then execute test/test.js.
Result with v5.10.1:
module.js:341
throw err;
^
Error: Cannot find module 'a/'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/home/mzasso/test/test.js:1:63)
Result with v6.0.0-rc.2 / master:
module.js:128
for (var i = 0; i < exts.length; i++) {
^
TypeError: Cannot read property 'length' of undefined
at tryExtensions (module.js:128:27)
at tryPackage (module.js:107:10)
at Function.Module._findPath (module.js:182:18)
at Function.Module._resolveFilename (module.js:434:25)
at Function.Module._load (module.js:384:25)
at Module.require (module.js:464:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/home/mzasso/test/test.js:1:63)
Activity
module: fix resolution of filename with trailing slash
module: fix resolution of filename with trailing slash
module: fix resolution of filename with trailing slash