docpad/docpad

Error: Cannot find module 'editions'

dstack opened this issue · 4 comments

Fresh install of docpad, locally or globally, I get the same error.

docpad: 6.81.0 and 6.80.9
node: 10.9.0
npm: 6.4.0
Windows 10

Error: Cannot find module 'editions'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (D:\Apps\dscom5\node_modules\docpad\bin.js:2:18)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)

This specific example is from "docpad init" but I get the same running "docpad -v", really anything with docpad.

@balupton after some trial and error, I have established that the module "editions" is in fact installed, in a spot that globally installed docpad can reach it. From what I have found so far, only modules using editions are having problems loading, which I verified by modifying bin.js to try and load "ambi" first.

My hunch is that the initial require for "editions" is attempting to load editions/package.json -> main. From there, it's a number of possibilities:

  • the folders containing the editions are named like "editionnode0.8" on windows (character refuses to print here, it's a very small bullet, have not tracked down the unicode for it yet)
  • editions is attempting to use itself to load itself
  • Node 10.9.0 incompatibility
  • NPM 6.4.0 incompatibility

Thanks @balupton 👍 .

For anyone else that runs into this on windows, falling back to docpad@6.79.0 resolves this.

this should now be resolved for most packages

resolution in docpad will take a bit longer... it will now show up however as could not find docpad