下一次部署仅在 Amplify 上失败

2024-01-01

我尝试在 AWS Amplify 上部署 Next.js 应用程序,但始终失败。
构建在本地环境中运行得非常好,我什至成功地在 Vercel 上部署。
但它只在放大上失败:(

我能够通过创建一个来部署.babelrc文件,但我正在寻找保留 SWC. 文件的更好解决方案。

I tried:

  • rm package-lock.json && rm -rf node_modules并重新安装(npm install --force)
  • Install @next/swc-linux-x64-gnu and @next/swc-linux-x64-musl作为可选依赖项
  • Set swcMinify选项false in next.config.js
  • Remove compiler选项中next.config.js

▼ 环境

v16.13.2 x64 linux

package.json

{
  "name": "my-project",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@svgr/webpack": "^6.2.1",
    "clsx": "^1.2.1",
    "framer-motion": "^6.4.3",
    "next": "12.2.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-query": "^3.39.1",
    "react-use": "^17.4.0",
    "recoil": "^0.7.4",
    "styled-components": "^5.3.5",
    "twemoji": "^14.0.2"
  },
  "devDependencies": {
    "@types/node": "18.0.3",
    "@types/react": "18.0.15",
    "@types/react-dom": "18.0.6",
    "@types/styled-components": "^5.1.25",
    "eslint": "8.19.0",
    "eslint-config-next": "12.2.2",
    "typescript": "4.7.4"
  }
}

next.config.js

/** @type {import('next').NextConfig} */

const nextConfig = {
  webpack(config) {
    config.module.rules.push({
      test: /\.svg$/,
      use: ['@svgr/webpack'],
    })
    return config
  },
  reactStrictMode: true,
  swcMinify: true,
  compiler: {
    styledComponents: {
      displayName: true,
      ssr: true,
    },
  },
}

module.exports = nextConfig

▼ 错误日志

                                                                  # Starting phase: preBuild
                                 # Executing command: nvm use --lts
2022-07-13T23:48:13.094Z [INFO]: Now using node v16.13.2 (npm v8.1.2)
2022-07-13T23:48:13.095Z [INFO]: # Executing command: node -e 'console.log(process.version, process.arch, process.platform)'
2022-07-13T23:48:13.122Z [INFO]: v16.13.2 x64 linux
2022-07-13T23:48:13.125Z [INFO]: # Executing command: npm ci --include=optional
2022-07-13T23:48:20.109Z [WARNING]: npm
2022-07-13T23:48:20.111Z [WARNING]: WARN deprecated [email protected] /cdn-cgi/l/email-protection: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
2022-07-13T23:48:27.374Z [INFO]: added 508 packages, and audited 509 packages in 14s
2022-07-13T23:48:27.377Z [INFO]: 100 packages are looking for funding
                                 run `npm fund` for details
                                 found 0 vulnerabilities
2022-07-13T23:48:27.389Z [INFO]: # Completed phase: preBuild
2022-07-13T23:48:27.389Z [INFO]: # Starting phase: build
                                 # Executing command: npm run build
2022-07-13T23:48:27.663Z [INFO]: > [email protected] /cdn-cgi/l/email-protection build
                                 > next build
2022-07-13T23:48:28.057Z [INFO]: info  - SWC minify release candidate enabled. https://nextjs.link/swcmin
2022-07-13T23:48:28.065Z [INFO]: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2022-07-13T23:48:28.086Z [INFO]: Attention: Next.js now collects completely anonymous telemetry regarding usage.
2022-07-13T23:48:28.086Z [INFO]: This information is used to shape Next.js' roadmap and prioritize features.
                                 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:
                                 https://nextjs.org/telemetry
2022-07-13T23:48:28.174Z [INFO]: info  - Linting and checking validity of types...
2022-07-13T23:48:33.726Z [INFO]: info  - Creating an optimized production build...
2022-07-13T23:48:34.350Z [INFO]: info  - Downloading WASM swc package...
2022-07-13T23:48:35.445Z [INFO]: info  - Using experimental wasm build of next-swc
2022-07-13T23:48:35.613Z [WARNING]: warn  - Attempted to load @next/swc-linux-x64-gnu, but an error occurred: libssl.so.1.1: cannot open shared object file: No such file or directory
2022-07-13T23:48:35.614Z [WARNING]: warn  - Attempted to load @next/swc-linux-x64-gnux32, but it was not installed
                                    warn  - Attempted to load @next/swc-linux-x64-musl, but an error occurred: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
2022-07-13T23:48:48.873Z [WARNING]: panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Error { kind: Unsupported, message: "operation not supported on this platform" }) }', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:170:10
                                    Stack:
                                    Error
                                    at module.exports.__wbg_new_693216e109162396 (/codebuild/output/src358588912/src/my-project/node_modules/next/wasm/@next/swc-wasm-nodejs/wasm.js:202:17)
                                    at wasm://wasm/059aa236:wasm-function[5445]:0xf90917
                                    at wasm://wasm/059aa236:wasm-function[13700]:0x11eca7b
                                    at wasm://wasm/059aa236:wasm-function[9995]:0x1186adc
                                    at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
                                    at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
                                    at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
                                    at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
                                    at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
                                    at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
2022-07-13T23:48:48.911Z [WARNING]: panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: GlobalPoolAlreadyInitialized }', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:170:10
                                    Stack:
                                    Error
                                    at module.exports.__wbg_new_693216e109162396 (/codebuild/output/src358588912/src/my-project/node_modules/next/wasm/@next/swc-wasm-nodejs/wasm.js:202:17)
                                    at wasm://wasm/059aa236:wasm-function[5445]:0xf90917
                                    at wasm://wasm/059aa236:wasm-function[13700]:0x11eca7b
                                    at wasm://wasm/059aa236:wasm-function[9995]:0x1186adc
                                    at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
                                    at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
                                    at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
                                    at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
                                    at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
                                    at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
2022-07-13T23:48:49.415Z [WARNING]: Failed to compile.
                                    static/chunks/pages/_app-8aa2b8cf1034125e.js from Terser
                                    unreachable
                                    RuntimeError: unreachable
                                    at wasm://wasm/059aa236:wasm-function[9995]:0x1186aff
                                    at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
                                    at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
                                    at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
                                    at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
                                    at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
                                    at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
                                    at wasm://wasm/059aa236:wasm-function[654]:0x760098
                                    at wasm://wasm/059aa236:wasm-function[3154]:0xd6fe73
                                    at wasm://wasm/059aa236:wasm-function[654]:0x75f24f
                                    static/chunks/framework-a1d4bfd54c97f1bc.js from Terser
                                    unreachable
                                    RuntimeError: unreachable
                                    at wasm://wasm/059aa236:wasm-function[9995]:0x1186afd
                                    at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
                                    at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
                                    at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
                                    at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
                                    at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
                                    at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
                                    at wasm://wasm/059aa236:wasm-function[654]:0x760098
                                    at wasm://wasm/059aa236:wasm-function[3154]:0xd6fe73
                                    at wasm://wasm/059aa236:wasm-function[654]:0x75f24f
2022-07-13T23:48:49.417Z [WARNING]: 
2022-07-13T23:48:49.417Z [WARNING]: > Build failed because of webpack errors
2022-07-13T23:48:49.456Z [ERROR]: !!! Build failed
2022-07-13T23:48:49.457Z [ERROR]: !!! Non-Zero Exit Code detected
2022-07-13T23:48:49.457Z [INFO]: # Starting environment caching...
2022-07-13T23:48:49.457Z [INFO]: # Uploading environment cache artifact...
2022-07-13T23:48:49.532Z [INFO]: # Environment caching completed
Terminating logging...

将 nextjs 版本降级到 12.2.0 应该可以正常工作! 详细信息在这里:https://github.com/vercel/next.js/issues/38436 https://github.com/vercel/next.js/issues/38436

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

下一次部署仅在 Amplify 上失败 的相关文章

随机推荐

  • 如何通过 Azure DevOps 在 Dockerfile 中设置环境变量

    在我的项目 Docker 文件中 我有一些环境变量 如下所示 ENV ACCEPT EULA Y ENV SA PASSWORD Password ENV MSSQL PID Developer ENV MSSQL TCP PORT 143
  • 在应用程序域之间来回传递集合对象

    以下示例基于 在应用程序域之间来回传递值 https stackoverflow com questions 1250774 passing values back and forth appdomains 其中 Marc Gravell
  • 扩展运算符类似物

    我有一个结构体和该结构体的实例 type Obj struct ssid string code string mit string and other props 23 var ValidObject Obj ssid AK93 KADJ
  • Android 应用程序连接到网络服务 - 不工作

    我正在尝试将我的应用程序连接到我在 asp net 中创建的 WCF 服务 该服务在我的本地计算机上运行 http localhost 8080 Service svc http localhost 8080 Service svc 但由于
  • 批量归一化 - Tensorflow

    我看过一些 BN 的例子 但还是有点困惑 所以我目前正在使用这个函数 它调用这里的函数 https github com tensorflow tensorflow blob master tensorflow g3doc api docs
  • 解压 sys.argv 时 Pylint 误报

    我有一个解压脚本sys argv到一个函数中 像这样 import sys def do something a b It doesn t matter what this function does print a b if name m
  • WPF 链绑定

    我想创建一个像这样的链绑定 我有一个用户控件 在具有类似依赖属性的窗口内具有依赖属性 我想将用户控件的依赖属性绑定到窗口的依赖属性 我创建了一个示例项目来演示我的问题 用户控件1 XAML
  • 打印到终端末尾

    Like this picture of apt get how can I print something at the end of the line just like the speed on the screen Although
  • 是否可以将 Google 服务帐户限制为项目内的特定 BigQuery 数据集?

    我已使用 GCP UI 为特定项目设置了一个服务帐号Project X 之内Project X有3个数据集 Dataset 1 Dataset 2 Dataset 3 如果我分配角色BigQuery Admin to Project X目前
  • 对于同一新对象多次调用 Firebase FEventTypeChildAdded 回调

    我正在开发一个 iOS 应用程序 并且我在 Firebase 的登录演示应用程序之上构建了我的项目 我可以通过 Facebook 进行身份验证 并与 Firebase 进行良好的通信 当我按下注销按钮时 运行的代码如下 void logou
  • 如何使用共享网址和命令行从 Google Colab 获取“原始”ipynb 文件?

    为 Google Colab 获取的 共享 url 链接到一个包含大量额外 HTML 的文件 因此当您尝试使用 wget 或 curl 下载该文件时 您不会获得有效的 Jupyter ipynb 文件 如何使用 wget 或 curl 等命
  • Numpy 平均函数舍入误差

    我觉得这很奇怪 有人能告诉我这是怎么回事吗 gt gt gt a 1 0 1 gt gt gt np mean a 0 66666666666666663 gt gt gt 2 0 3 0 6666666666666666 输出末尾的 3
  • 哈希或其他对象的内存大小?

    在 Ruby 1 9 3 中获取给定散列 或任何对象 的大小 以字节为单位 的最佳方法是什么 解决方案 查找特定哈希在 Ruby 中使用的字节数 https stackoverflow com questions 3687073 find
  • Javascript HTML5 Canvas 绘制透明圆圈

    我需要一个函数来在画布上绘制几个圆圈 从 center x y 处的 mousedown 开始 然后将鼠标拖动到 deltaX deltaY 从而为每个圆圈创建半径 r 圆圈不能填充 需要透明 以便用户可以清楚地看到圆圈相交的位置 我当前的
  • 分裂b+树中的节点

    我试图弄清楚当节点溢出时到底会发生什么 信息 在我的 b 树中 每个块有 4 个指针和 3 个数据部分 问题 我明白 当出现溢出时 我们会分成 2 个节点 每个节点有 2 个节点 键 并将中间值插入父节点 而不从子节点中删除 与 b 树不同
  • 获取列表列表中的最大值列表

    我有一个List
  • Python 字典包含编码值

    我有一个熊猫数据框oParameterData我使用 Hive ODBC 连接在 Hadoop 上构建了查询 我用它来填充一个名为的 Python 字典oParameter import pyodbc import pandas oConn
  • iOS - 如何在更改视图时停止背景音乐

    如何在改变视图时停止背景音乐 我没有任何线索 如果我按下一个按钮 将我带到一个新的视图 就会有新的背景音乐 但旧的背景音乐 无限循环 仍在继续 请帮忙 还请示例一些代码 这是我的 void viewDidLoad NSString path
  • 使用 PDO 获取插入和更新 ID

    我想得到mysql insert id使用 PDO 到目前为止 我还没有找到一个可以同时用于插入和更新的好例子 有人有一段完整的代码作为示例吗 If you need pdo gt lastInsertId 要返回刚刚更新的行的 id 如果
  • 下一次部署仅在 Amplify 上失败

    我尝试在 AWS Amplify 上部署 Next js 应用程序 但始终失败 构建在本地环境中运行得非常好 我什至成功地在 Vercel 上部署 但它只在放大上失败 我能够通过创建一个来部署 babelrc文件 但我正在寻找保留 SWC