danburzo/percollate

Error: Cannot find module 'uuid'

Jackymancs4 opened this issue · 3 comments

Environment

  • Operating System: Ubuntu 18.04.5
  • node --version: v16.3.0
  • npm --version: v7.15.0
  • percollate --version: 1.2.3

Description

Hello @danburzo
After installing with npm install -g percollate launching it always return:

$ percollate epub https://explained-from-first-principles.com/email
node:internal/modules/cjs/loader:944
  throw err;
  ^

Error: Cannot find module 'uuid'
Require stack:
- /home/jack/.nvm/versions/node/v16.3.0/lib/node_modules/percollate/index.js
- /home/jack/.nvm/versions/node/v16.3.0/lib/node_modules/percollate/cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
    at Function.Module._load (node:internal/modules/cjs/loader:774:27)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/home/jack/.nvm/versions/node/v16.3.0/lib/node_modules/percollate/index.js:15:22)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Module.require (node:internal/modules/cjs/loader:1013:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/jack/.nvm/versions/node/v16.3.0/lib/node_modules/percollate/index.js',
    '/home/jack/.nvm/versions/node/v16.3.0/lib/node_modules/percollate/cli.js'
  ]
}

Which indicates that the uuid module is not installed.
Indeed looking at https://github.com/danburzo/percollate/blob/master/package.json it is not specified as a dependency.

Looking here

"uuid": {
it appears to be present, but in very old version (v3 vs the current v8), which most likely does not support modern module import.

Installing uuid as a global package (npm install -g uuid) does fix the problem but should not be necessary.

Fixing the issue seems trivial, so I could open a PR if you like.

Anyway thanks!

Thanks for the report @Jackymancs4! The code indeed seems to be relying on a transitive dependency on uuid 😬 I'll figure out where in the commit history we lost it. No need for a PR since the fix is trivial, will fix in a sec. I'm curious how exactly it breaks in node 16 / npm 7 vs. node 15 / npm 6.x.

Should be fixed in percollate@1.2.4, can you let me know if it works correctly on your setup?

I confirm that after running:

$ npm remove -g uuid
$ npm update -g percollate
$ percollate --version
1.2.4

everything is working perfectly.
Thanks for the quick fix!