将 NextJs 应用程序部署到 firebase 托管时出现卡住或挂起问题

Mah*_*ist 7 firebase-hosting firebase-tools google-cloud-functions next.js

我有一个 NextJS 应用程序,我正在尝试将其部署到 firebase 托管,但是在firebase deploy命令过程中它似乎被卡住并无限期挂起(几个小时等待无济于事)。部署日志如下

\n

这是next.config.js

\n
/** @type {import('next').NextConfig} */\nconst nextConfig = {\n  experimental: { appDir: true },\n}\n\nmodule.exports = nextConfig\n
Run Code Online (Sandbox Code Playgroud)\n

我的node版本是v16.8.0,我的NPM版本是7.21.0

\n

初始化 firebase 时,我运行firebase experiments:enable webframeworks然后firebase init初始化项目,之后我运行firebase deploy,这是日志:

\n
Detected a Next.js codebase. This is an experimental integration, proceed with caution.\n\nwarn  - You have enabled experimental feature (appDir) in next.config.js.\nwarn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.\ninfo  - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback\n\ninfo  - Creating an optimized production build\ninfo  - Compiled successfully\ninfo  - Linting and checking validity of types\ninfo  - Collecting page data\n[    ] info  - Generating static pages (0/7)styles.container Header_container__mD0ij\ninfo  - Generating static pages (7/7)\ninfo  - Finalizing page optimization\n\nRoute (pages)                              Size     First Load JS\n\xe2\x94\x8c \xe2\x97\x8b / (617 ms)                             3.71 kB         109 kB\n\xe2\x94\x9c   \xe2\x94\x94 css/fdb2f6acb69fe1ad.css             794 B\n\xe2\x94\x9c   /_app                                  0 B            97.3 kB\n\xe2\x94\x9c \xe2\x97\x8b /404                                   179 B          97.5 kB\n\xe2\x94\x9c \xe2\x97\x8b /biography (461 ms)                    3.48 kB         111 kB\n\xe2\x94\x9c   \xe2\x94\x94 css/65eda0ce9bb2b5b9.css             1.45 kB\n\xe2\x94\x9c \xe2\x97\x8b /indexx (405 ms)                       4.56 kB         112 kB\n\xe2\x94\x9c   \xe2\x94\x94 css/2805e6d097bc0e08.css             2.95 kB\n\xe2\x94\x9c \xe2\x97\x8b /news (399 ms)                         2.69 kB         110 kB\n\xe2\x94\x9c   \xe2\x94\x94 css/e3f7d4147fa456f7.css             1.1 kB\n\xe2\x94\x94 \xe2\x97\x8b /shop (623 ms)                         1.62 kB         107 kB\n    \xe2\x94\x94 css/75bc53145ed6cfe5.css             506 B\n+ First Load JS shared by all              127 kB\n  \xe2\x94\x9c chunks/main-d2e0a2e45955cc22.js        78.7 kB\n  \xe2\x94\x9c chunks/pages/_app-e1b5cdce79d3f8aa.js  17 kB\n  \xe2\x94\x9c chunks/webpack-e5138252bb357a88.js     1.6 kB\n  \xe2\x94\x94 css/b57b70b80e694460.css               29.3 kB\n\n\xe2\x97\x8b  (Static)  automatically rendered as static HTML (uses no initial props)\n\nBuilding a Cloud Function to run this application. This is needed due to:\n \xe2\x80\xa2 Image Optimization\n \xe2\x80\xa2 app directory (unstable)\n \xe2\x80\xa2 non-static route /biography\n \xe2\x80\xa2 non-static route /news\n \xe2\x80\xa2 non-static route /indexx\n \xe2\x80\xa2 and 1 other reasons, use --debug to see more\n\nUnable to bundle next.config.js for use in Cloud Functions, proceeding with deploy but problems may be enountered.\nThe command line is too long.\n\n\nchanged 1 package in 49s\n\n119 packages are looking for funding\n  run `npm fund` for details\n\n=== Deploying to 'moudstest-proj'...\n\ni  deploying functions, hosting\ni  functions: preparing codebase firebase-frameworks-moudstest-proj for deployment\ni  functions: ensuring required API cloudfunctions.googleapis.com is enabled...\ni  functions: ensuring required API cloudbuild.googleapis.com is enabled...\ni  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...\n+  artifactregistry: required API artifactregistry.googleapis.com is enabled\n+  functions: required API cloudbuild.googleapis.com is enabled\n+  functions: required API cloudfunctions.googleapis.com is enabled\n!  functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.\n!  functions: Please note that there will be breaking changes when you upgrade.\ni  functions: Loaded environment variables from .env.\ni  functions: preparing .firebase\\moudstest-proj\\functions directory for uploading...\ni  functions: packaged D:\\Projects\\MENA\\MZPersonalWebsite\\.firebase\\moudstest-proj\\functions (127.64 MB) for uploading\ni  functions: ensuring required API run.googleapis.com is enabled...\ni  functions: ensuring required API eventarc.googleapis.com is enabled...\ni  functions: ensuring required API pubsub.googleapis.com is enabled...\ni  functions: ensuring required API storage.googleapis.com is enabled...\n+  functions: required API eventarc.googleapis.com is enabled\n+  functions: required API run.googleapis.com is enabled\n+  functions: required API storage.googleapis.com is enabled\n+  functions: required API pubsub.googleapis.com is enabled\ni  functions: generating the service identity for pubsub.googleapis.com...\ni  functions: generating the service identity for eventarc.googleapis.com...\n
Run Code Online (Sandbox Code Playgroud)\n

我从日志中可以看到:

\n
    \n
  1. functions: generating the service identity for eventarc.googleapis.com尽管互联网连接稳定且没有明显错误,但部署仍处于停滞状态。
  2. \n
  3. 部署进行到一半时,它打印出来,Unable to bundle next.config.js for use in Cloud Functions, proceeding with deploy but problems may be enountered. The command line is too long.我不确定原因是什么。
  4. \n
\n