gpt4 book ai didi

reactjs - Material 用户界面:找不到模块: './AccessAlarm'

转载 作者:行者123 更新时间:2023-12-04 15:33:56 24 4
gpt4 key购买 nike

我们有一个使用@material-ui 的项目。它建立在:

  • 创建 react 应用程序:3.4
  • 节点:10.18.1
  • yarn :1.21.1
  • @material-ui: 4.9.x

这个问题很奇怪:我可以在本地yarn startyarn build,版本与服务器完全相同。但是,在我推送到服务器后,它失败了:

[4/4] Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
└─ @material-ui/icons@4.9.1
info All dependencies
└─ @material-ui/icons@4.9.1
Done in 8.27s.
+ yarn run build:dev
yarn run v1.21.1
$ cp .env.sample .env && react-scripts build
The following changes are being made to your tsconfig.json file:
- compilerOptions.paths must not be set (aliased imports are not supported)

Creating an optimized production build...
Failed to compile.

./node_modules/@material-ui/icons/esm/index.js
Cannot find module: './AccessAlarm'. Make sure this package is installed.

You can install this package by running: yarn add ./AccessAlarm.

服务器上的搭建步骤是:

node -v
rm yarn.lock
rm -rf build node_modules
yarn install
yarn add @material-ui/core // I have tried to run with and w/o these two lines
yarn add @material-ui/icons
yarn run build:dev

有人对此有任何想法吗?谢谢。

最佳答案

yarn cache clean 可以解决问题。

关于reactjs - Material 用户界面:找不到模块: './AccessAlarm',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60409569/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com