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 [ERR_INVALID_ARG_TYPE]: The "superCtor.prototype" property must be of type object. Received undefined #488

Open
btakita opened this issue Sep 10, 2022 · 3 comments

Comments

@btakita
Copy link

btakita commented Sep 10, 2022

When using rollup without vite...the following error occurs on pnpm install:

TypeError [ERR_INVALID_ARG_TYPE]: The "superCtor.prototype" property must be of type object. Received undefined
│     at new NodeError (node:internal/errors:387:5)
│     at inherits (node:util:243:11)
│     at Object.<anonymous> (/home/brian/project/node_modules/.pnpm/[email protected]/node_modules/bl/bl.js:36:1)
│     at Module._compile (node:internal/modules/cjs/loader:1126:14)
│     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
│     at Module.load (node:internal/modules/cjs/loader:1004:32)
│     at Function.Module._load (node:internal/modules/cjs/loader:839:12)
│     at Module.require (node:internal/modules/cjs/loader:1028:19)
│     at require (node:internal/modules/cjs/helpers:102:18)
│     at Object.<anonymous> (/home/brian/project/node_modules/.pnpm/[email protected]/node_modules/tar-stream/extract.
│   code: 'ERR_INVALID_ARG_TYPE'

Note that I use .pnpmfile.cjs to alias readable-stream with vite-compatible-readable-stream. I don't see an issues tab with https://github.com/exogee-technology/readable-stream, so I'm raising the issue here. Hopefully the circular dependency with readable-stream will be fixed so the vite-compatible-readable-stream fork would not be necessary.

function readPackage(pkg) {
  if (pkg.dependencies && pkg.dependencies['readable-stream']) {
    pkg.dependencies['readable-stream'] = 'npm:vite-compatible-readable-stream@latest'
  }
  return pkg
}

module.exports = {
  hooks: {
    readPackage
  }
}
@mcollina
Copy link
Member

Thanks for reporting. You can just use this module. Its version 4 has the circular dependency fixed.

If you still have the problem after upgrading, can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

For any other bugs in vite-compatible-readable-stream, please contact their maintainers.
Thanks for reporting!

@AtiX
Copy link

AtiX commented Oct 19, 2022

I'm trying to use readable-stream with rollup and still run into the circular dependency issue, as version 4.2.0 in fact still has a circular dependency (here <-> here, for example) which then causes problems when using readable-stream in the bundle.

The rollup output complains about the circular dependencies:

Circular dependency: node_modules/readable-stream/lib/internal/streams/duplex.js -> node_modules/readable-stream/lib/internal/streams/readable.js -> node_modules/readable-stream/lib/internal/streams/duplex.js
Circular dependency: node_modules/readable-stream/lib/internal/streams/duplex.js -> node_modules/readable-stream/lib/internal/streams/writable.js -> node_modules/readable-stream/lib/internal/streams/duplex.js
Circular dependency: node_modules/readable-stream/lib/internal/streams/duplex.js -> node_modules/readable-stream/lib/internal/streams/duplexify.js -> node_modules/readable-stream/lib/internal/streams/duplex.js

which then, when attempting to use the (bundled) code, gives me the error

Class extends value undefined is not a constructor or null

where I assume that rollup resolved DuplexStream to undefined due to rollups handling of the circular dependency.

@luiscastro193
Copy link

Atix is right. Rollup bundles fail due to circular dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants