/usr/local/lib/node_modules/app-root-path-ubuntu-repro/node_modules/app-root-path/lib/resolve.js:111
appRootPath = path.dirname(requireFunction.main.filename);
^
TypeError: Cannot read properties of undefined (reading 'filename')
at resolve (/usr/local/lib/node_modules/spellchecker-cli/node_modules/app-root-path/lib/resolve.js:111:51)
at module.exports (/usr/local/lib/node_modules/spellchecker-cli/node_modules/app-root-path/lib/app-root-path.js:6:20)
at Object.<anonymous> (/usr/local/lib/node_modules/spellchecker-cli/node_modules/app-root-path/index.js:4:18)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29)
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
The error is:
I've created a repo that you can use to reproduce this error: https://github.com/tbroadley/app-root-path-ubuntu-repro
I think the issue is that app-root-path assumes that
requireFunction.main
is always defined. However, according to the Node.js documentation: