Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'onReady' of undefined #1649

Closed
cedx opened this issue May 8, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@cedx
Copy link

commented May 8, 2019

I'm unable to generate the documentation of this project on Node.js 12.1.0. It's not tied to the project: all my JS projects are affected (EDIT : all are now using the new ES modules).

Input code

See the source code :) I've also tried with a dumb class like this one (and nothing else):

export class DummyClass {}

JSDoc configuration

{
  "opts": {
    "destination": "doc/api",
    "recurse": true
  },
  "source": {
    "include": ["lib"]
  },
  "sourceType": "module"
}

JSDoc debug output

DEBUG: JSDoc 3.6.1 (Sun, 05 May 2019 19:24:09 GMT)
DEBUG: Environment info: {"env":{"conf":{"plugins":[],"recurseDepth":10,"source":{"includePattern":".+\\.js(doc|x)?$","excludePattern":"","include":["lib"]},"sourceType":"module","tags":{"allowUnknownTags":true,"dictionaries":["jsdoc","closure"]},"templates":{"monospaceLinks":false,"cleverLinks":false},"opts":{"destination":"doc/api","recurse":true}},"opts":{"_":[],"debug":true,"configure":"etc/jsdoc.json","destination":"doc/api","recurse":true,"encoding":"utf8"}}}

Expected behavior

The API documentation is generated.

Current behavior

I get this error:

internal/modules/cjs/loader.js:638
      module.reflect.onReady((reflect) => {
                     ^

TypeError: Cannot read property 'onReady' of undefined
    at Module.load (internal/modules/cjs/loader.js:638:22)
    at Object.load (/home/cedric/.npm/_npx/11112/lib/node_modules/jsdoc/node_modules/requizzle/lib/loader.js:105:18)
    at Requizzle.requizzle (/home/cedric/.npm/_npx/11112/lib/node_modules/jsdoc/node_modules/requizzle/lib/requizzle.js:87:31)
    at infectProxy (/home/cedric/.npm/_npx/11112/lib/node_modules/jsdoc/node_modules/requizzle/lib/loader.js:79:31)
    at Module.targetModule.require (/home/cedric/.npm/_npx/11112/lib/node_modules/jsdoc/node_modules/requizzle/lib/loader.js:97:44)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/home/cedric/.npm/_npx/11112/lib/node_modules/jsdoc/node_modules/catharsis/lib/describe.js:1:247)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Object.load (/home/cedric/.npm/_npx/11112/lib/node_modules/jsdoc/node_modules/requizzle/lib/loader.js:105:18)
    at Requizzle.requizzle (/home/cedric/.npm/_npx/11112/lib/node_modules/jsdoc/node_modules/requizzle/lib/requizzle.js:87:31)
    at infectProxy (/home/cedric/.npm/_npx/11112/lib/node_modules/jsdoc/node_modules/requizzle/lib/loader.js:79:31)
    at Module.targetModule.require (/home/cedric/.npm/_npx/11112/lib/node_modules/jsdoc/node_modules/requizzle/lib/loader.js:97:44)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/home/cedric/.npm/_npx/11112/lib/node_modules/jsdoc/node_modules/catharsis/catharsis.js:9:18)

Your environment

Software Version
JSDoc 3.6.1
Node.js 12.1.0
npm 6.9.0
Operating system Ubuntu 19.04
@hegemonic

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

I'm not able to reproduce this issue with the which.js repo. My environment is mostly consistent with yours; I even tested with npx. But I'm testing on macOS, not Ubuntu. My best guess is that our unconscionable require() hackery has issues with Node.js 12 on at least some Linux distros.

But I'm guessing it doesn't fail on every Linux distro, or else there would be more bugs about this (and, come to think of it, the CI builds would have failed). Do you have access to a different environment that you can test in, just to see if you're able to reproduce the problem there? I don't mind digging into this further, but it would be helpful to understand the scope of the problem a little better.

@cedx

This comment has been minimized.

Copy link
Author

commented May 10, 2019

(First of all: thanks for your work!)

I've tried on a Windows 10 (version 1809) machine with Node.js 12.2.0: same error....
I've tried to rename the input files to .mjs and remove the type field from package.json file. Still no luck.

$ .\node_modules\.bin\jsdoc --debug --configure jsdoc.json
DEBUG: JSDoc 3.6.1 (Sun, 05 May 2019 19:24:09 GMT)
DEBUG: Environment info: {"env":{"conf":{"plugins":[],"recurseDepth":10,"source":{"includePattern":".+\\.mjs(doc|x)?$","excludePattern":"","include":["lib"]},"sourceType":"module","tags":{"allowUnknownTags":true,"dictionaries":["jsdoc","closure"]},"templates":{"monospaceLinks":false,"cleverLinks":false},"opts":{"destination":"doc/api","recurse":true}},"opts":{"_":[],"debug":true,"configure":"jsdoc.json","destination":"doc/api","recurse":true,"encoding":"utf8"}}}
internal/modules/cjs/loader.js:638
      module.reflect.onReady((reflect) => {
                     ^

TypeError: Cannot read property 'onReady' of undefined
    at Module.load (internal/modules/cjs/loader.js:638:22)
    at Object.load (C:\Repo\js\which.js\node_modules\requizzle\lib\loader.js:105:18)
    at Requizzle.requizzle (C:\Repo\js\which.js\node_modules\requizzle\lib\requizzle.js:87:31)
    at infectProxy (C:\Repo\js\which.js\node_modules\requizzle\lib\loader.js:79:31)
    at Module.targetModule.require (C:\Repo\js\which.js\node_modules\requizzle\lib\loader.js:97:44)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (C:\Repo\js\which.js\node_modules\catharsis\lib\describe.js:1:233)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Object.load (C:\Repo\js\which.js\node_modules\requizzle\lib\loader.js:105:18)
    at Requizzle.requizzle (C:\Repo\js\which.js\node_modules\requizzle\lib\requizzle.js:87:31)
    at infectProxy (C:\Repo\js\which.js\node_modules\requizzle\lib\loader.js:79:31)
    at Module.targetModule.require (C:\Repo\js\which.js\node_modules\requizzle\lib\loader.js:97:44)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (C:\Repo\js\which.js\node_modules\catharsis\catharsis.js:9:18)

I think the problem is not really with JSDoc, but with the Module.load API:

I'm closing this issue as this is not the root cause of the error, and it's clearly too early to use ES modules with Node.js 😢

@cedx cedx closed this May 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.