SyntaxError: Named export 'styled' not found. The requested module '@mui/material/styles/index.js' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using:
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Start with the authentication-support documentation example and the stack trace location in @api-platform/admin/lib/layout/Error.js. Reproduce the error using the shown HydraAdmin setup and official Docker image, then compare the package's module imports with the reported @mui/material/styles/index.js failure. Done means the documented authentication setup renders without this server error.
Written by the indexing model from the issue text.
Description
API Platform version(s) affected: '@api-platform/admin': ^3.4.3
Description
I trying run auth on admin but I got error:
Server Error
SyntaxError: Named export 'styled' not found. The requested module '@mui/material/styles/index.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@mui/material/styles/index.js';
const { styled } = pkg;
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
<unknown>
file:///srv/app/node_modules/.pnpm/@api-platform+admin@3.4.3_zula6vjvt3wdocc4mwcxqa6nzi/node_modules/@api-platform/admin/lib/layout/Error.js (15)
ModuleJob._instantiate
node:internal/modules/esm/module_job (124:21)
async ModuleJob.run
node:internal/modules/esm/module_job (190:5)
How to reproduce
I just using code from docs: https://api-platform.com/docs/admin/authentication-support/
Possible Solution
I don't now. Frontend has never been my strong suit
Additional Context
Using this:
import React from 'react';
import ReactDOM from 'react-dom';
import { HydraAdmin } from '@api-platform/admin';
const Admin = () => <HydraAdmin entrypoint="https://demo.api-platform.com" />;
ReactDOM.render(<Admin />, document.getElementById('root'));
I am getting exactly the same error.
I using official docker images: https://github.com/api-platform/api-platform
- Dominant language
- TypeScript
- Stars
- 516
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from api-platform/admin
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
api-platform/admin#616 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 64/100
api-platform/admin#660 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
api-platform/admin#659 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
api-platform/admin#631 · 6 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
api-platform/admin#626 · 1 comment · 1 reaction ·
All issues in api-platform/admin
Similar issues
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
supermomonga/zcode-acp#24 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100