如何在构建Next.js和Mui时修复错误?

huangapple go评论62阅读模式
英文:

How to fix error during build of next js and Mui?

问题

我已安装npm install @mui/material @emotion/react @emotion/server并尝试构建Next.js应用程序,在进行linting和类型检查期间收到了错误。

info  - Linting and checking validity of types ...Failed to compile.

./node_modules/@mui/base/useMenu/useMenu.d.ts:3:15
Type error: ',' expected.

  1 | import { MenuItemMetadata, UseMenuListboxSlotProps, UseMenuParameters } from ' ./useMenu.types';
  2 | import { EventHandlers } from ' ../utils';
> 3 | import { type MenuUnstyledContextType } from ' ../MenuUnstyled';
    |               ^
  4 | /**
  5 |  *

感谢你的帮助。

EsLint配置

    {
  "extends": ["next/core-web-vitals", "prettier"],
  "rules": {
    "object-curly-newline": [
      "error",
      {
        "ObjectExpression": {
          "minProperties": 1
        }
      }
    ],
    "arrow-body-style": ["error", "as-needed"],
    "@next/next/no-img-element": "off"
  }
}
英文:

I have installed npm install @mui/material @emotion/react @emotion/server and have tried to build next js app and received an error during linting and checking

info  - Linting and checking validity of types ...Failed to compile.

./node_modules/@mui/base/useMenu/useMenu.d.ts:3:15
Type error: ',' expected.

  1 | import { MenuItemMetadata, UseMenuListboxSlotProps, UseMenuParameters } from './useMenu.types';
  2 | import { EventHandlers } from '../utils';
> 3 | import { type MenuUnstyledContextType } from '../MenuUnstyled';
    |               ^
  4 | /**
  5 |  *

Thanks for your help.

EsLint config

    {
  "extends": ["next/core-web-vitals", "prettier"],
  "rules": {
    "object-curly-newline": [
      "error",
      {
        "ObjectExpression": {
          "minProperties": 1
        }
      }
    ],
    "arrow-body-style": ["error", "as-needed"],
    "@next/next/no-img-element": "off"
  }
}

答案1

得分: 1

我已经弄清楚如何解决我的项目问题,这可能也会帮助到其他人。我的TypeScript版本是4.4.9,我已经更改为4.5.2,并且代码检查通过了。

英文:

I have figured our how to fix my project problem and possibly that will help others as well. I have typescript version 4.4.9 I changed to 4.5.2 and linting passed correctly

huangapple
  • 本文由 发表于 2023年3月7日 01:48:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75654158.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定