SoftwareBrothers / adminjs

AdminJS is an admin panel for apps written in node.js
https://adminjs.co
MIT License
8.06k stars 646 forks source link

[Bug]: Errors during transpile #1637

Closed iamart closed 3 months ago

iamart commented 4 months ago

Contact Details

No response

What happened?

Running adminjs create fails with found mongoose 7.9. Empty directory. Installing manually works, up until I get to transpile. Fails with a bunch of

Cannot find module '@styled-components' or its corresponding type declarations. Installing this package manually just resolves to Namespace '"/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

Bug prevalence

all the time

AdminJS dependencies version

7.7.2

What browsers do you see the problem on?

No response

Relevant log output

No response

Relevant code that's giving you issues

No response

dziraf commented 4 months ago

The CLI for @adminjs/mongoose broke after the latest version started supporting only mongoose >= 8.0.0. This is now fixed in @adminjs/cli v1.0.5.

The error about @styled-components import that you got comes from the fact that Typescript doesn't rewrite path aliases to relative paths when building d.ts files. The tsconfig.json generated by @adminjs/cli comes with "skipLibCheck": true which makes the error go away but doesn't fix the underlying issue; I'll see if there are any news or workaround for this currently.

You shouldn't install styled-components manually. AdminJS is using a modified version 5.3.5 since the styled-components package wasn't compatible with ESM syntax when we were migrating to it.