vercel 中的部署错误构建失败命令“npm run build”以 1 退出

问题描述 投票:0回答:0

我正在构建一个使用 Firebase 身份验证和数据库的 Next.js 项目。 它在本地运行良好,但在任何托管网站上都收到错误消息

[02:57:52.702] Running build in San Francisco, USA (West) – sfo1
[02:57:52.755] Cloning github.com/Sumukha87/Post-it (Branch: main, Commit: 96c0ce0)
[02:57:52.763] Skipping build cache, deployment was triggered without cache.
[02:57:53.382] Cloning completed: 626.489ms
[02:57:53.577] Running "vercel build"
[02:57:54.147] Vercel CLI 29.0.3
[02:57:54.473] Installing dependencies...
[02:58:08.594] 
[02:58:08.594] added 201 packages in 14s
[02:58:08.594] 
[02:58:08.594] 23 packages are looking for funding
[02:58:08.594]   run `npm fund` for details
[02:58:08.615] Detected Next.js version: 13.3.2
[02:58:08.618] Detected `package-lock.json` generated by npm 7+...
[02:58:08.619] Running "npm run build"
[02:58:09.016] 
[02:58:09.016] > [email protected] build
[02:58:09.017] > next build
[02:58:09.017] 
[02:58:09.590] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[02:58:09.591] This information is used to shape Next.js' roadmap and prioritize features.
[02:58:09.591] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[02:58:09.591] https://nextjs.org/telemetry
[02:58:09.591] 
[02:58:09.751] info  - Linting and checking validity of types...
[02:58:09.924] info  - Creating an optimized production build...
[02:58:20.985] info  - Compiled successfully
[02:58:20.990] info  - Collecting page data...
[02:58:21.879] unhandledRejection Error [FirebaseError]: Firebase: Error (auth/invalid-api-key).
[02:58:21.879]     at createErrorInternal (file:///vercel/path0/node_modules/@firebase/auth/dist/node-esm/totp-035c6eef.js:490:40)
[02:58:21.880]     at _assert (file:///vercel/path0/node_modules/@firebase/auth/dist/node-esm/totp-035c6eef.js:494:15)
[02:58:21.880]     at Component.instanceFactory (file:///vercel/path0/node_modules/@firebase/auth/dist/node-esm/totp-035c6eef.js:6506:9)
[02:58:21.881]     at Provider.getOrInitializeService (file:///vercel/path0/node_modules/@firebase/component/dist/esm/index.esm2017.js:290:39)
[02:58:21.882]     at Provider.initialize (file:///vercel/path0/node_modules/@firebase/component/dist/esm/index.esm2017.js:234:31)
[02:58:21.882]     at initializeAuth (file:///vercel/path0/node_modules/@firebase/auth/dist/node-esm/totp-035c6eef.js:2943:27)
[02:58:21.882]     at getAuth (file:///vercel/path0/node_modules/@firebase/auth/dist/node-esm/totp-035c6eef.js:6571:18)
[02:58:21.883]     at /vercel/path0/.next/server/chunks/609.js:38:68 {
[02:58:21.883]   type: 'FirebaseError',
[02:58:21.883]   code: 'auth/invalid-api-key',
[02:58:21.884]   customData: { appName: '[DEFAULT]' }
[02:58:21.892] }
[02:58:21.959] Error: Command "npm run build" exited with 1
[02:58:22.316] Deployment completed
[02:58:22.275] BUILD_UTILS_SPAWN_1: Command "npm run build" exited with 1

我尝试将构建命令更改为 CI= npm build 但它仍然无效。

vercel next
© www.soinside.com 2019 - 2024. All rights reserved.