【发布时间】:2023-02-04 03:13:54
【问题描述】:
我正在使用 node 16.17.0 进行 React 项目设置,使用 "react": "^17.0.2" 创建 React App "react-scripts": "^5.0.0"
直到今天早上一切正常。当我尝试 npm run start 或 npm run build 时,出现以下错误。 npm install 工作正常,没有错误。
我得到的错误是:
ERROR in ./src/services/auth/firebase/firebase.js 3:0-45
Module not found: Error: Default condition should be last one
ERROR in ./src/services/auth/firebase/firebase.js 4:0-40
Module not found: Error: Default condition should be last one
ERROR in ./src/app/pages/payout/PayoutOpen.js 5:0-39
Module not found: Error: Default condition should be last one
ERROR in ./node_modules/@react-query-firebase/auth/dist/bundle.es.js 3:0-78
Module not found: Error: Default condition should be last one
ERROR in ./node_modules/@react-query-firebase/auth/dist/bundle.es.js 4:0-720
Module not found: Error: Default condition should be last one
这是我的firebase.js 文件的样子:
import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
const firebase = initializeApp({
apiKey: "********",
authDomain: "*******",
projectId: "*********",
storageBucket: "**********",
messagingSenderId: "***************",
appId: "****************",
measurementId: "*************"
});
export const auth = getAuth(firebase);
我试图删除node_modules 文件夹,删除package-lock.json 文件,清除 npm 缓存但没有任何效果。我也尝试使用 yarn 安装,但它显示相同的错误。
【问题讨论】:
-
可能与github issue有关。
-
是的,这就是问题,谢谢@SergeySosunov
-
决定正常回答你的问题,因为可能会有其他类似的问题,所以我们将能够将它们标记为你的重复。
标签: node.js reactjs firebase create-react-app