未找到放大版本`GLIBC_2.28'(节点需要)

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

还有很多与此相关的其他问题,但是,我正在寻找专门针对 amplify 的解决方案。

这是我的放大构建日志:

2024-01-14T16:14:17.626Z [INFO]: # Cloning repository: [email protected]:anay-208/portfolio.git
2024-01-14T16:14:19.076Z [INFO]: 
2024-01-14T16:14:19.077Z [INFO]: Cloning into 'portfolio'...
2024-01-14T16:14:19.077Z [INFO]: # Switching to commit: 893dd0dc396a332bc2055fe3df3086a8e20ecde9
2024-01-14T16:14:19.090Z [INFO]: Note: switching to '893dd0dc396a332bc2055fe3df3086a8e20ecde9'.
                                 You are in 'detached HEAD' state. You can look around, make experimental
                                 changes and commit them, and you can discard any commits you make in this
                                 state without impacting any branches by switching back to a branch.
                                 If you want to create a new branch to retain commits you create, you may
                                 do so (now or later) by using -c with the switch command. Example:
                                 git switch -c <new-branch-name>
                                 Or undo this operation with:
                                 git switch -
                                 Turn off this advice by setting config variable advice.detachedHead to false
                                 HEAD is now at 893dd0d Update email address in Introduction component
2024-01-14T16:14:19.134Z [INFO]: Successfully cleaned up Git credentials
2024-01-14T16:14:19.134Z [INFO]: # Checking for Git submodules at: /codebuild/output/src504315270/src/portfolio/.gitmodules
2024-01-14T16:14:19.141Z [INFO]: # Retrieving environment cache...
2024-01-14T16:14:19.173Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2024-01-14T16:14:19.173Z [INFO]: ---- Setting Up SSM Secrets ----
2024-01-14T16:14:19.173Z [INFO]: SSM params {"Path":"/amplify/d36nuq8xnduv8k/main/","WithDecryption":true}
2024-01-14T16:14:20.188Z [INFO]: No live updates for this build run
2024-01-14T16:14:20.191Z [INFO]: # Retrieving cache...
2024-01-14T16:14:20.220Z [INFO]: # Retrieved cache
2024-01-14T16:14:46.137Z [INFO]: ## Starting Backend Build
                                 # Starting phase: build
                                 # Executing command: nvm install 20
2024-01-14T16:14:47.024Z [INFO]: Downloading and installing node v20.11.0...
2024-01-14T16:14:47.157Z [WARNING]: Downloading https://nodejs.org/dist/v20.11.0/node-v20.11.0-linux-x64.tar.gz...
2024-01-14T16:14:47.275Z [WARNING]: ###############
2024-01-14T16:14:47.277Z [WARNING]: ##########                                                 35.6%
2024-01-14T16:14:47.375Z [WARNING]: ##############################
2024-01-14T16:14:47.376Z [WARNING]: ###########                                 58.2%
2024-01-14T16:14:47.477Z [WARNING]: ##########
2024-01-14T16:14:47.477Z [WARNING]: #############################################                   76.6%
2024-01-14T16:14:47.551Z [WARNING]: ###########################
2024-01-14T16:14:47.552Z [WARNING]: ############################################# 100.0%
2024-01-14T16:14:47.572Z [WARNING]: Computing checksum with sha256sum
2024-01-14T16:14:47.688Z [WARNING]: Checksums matched!
2024-01-14T16:14:48.949Z [INFO]: Now using node v20.11.0 (npm v)
2024-01-14T16:14:48.977Z [INFO]: Installing default global packages from /root/.nvm/default-packages...
                                 npm install -g --quiet [email protected]
2024-01-14T16:14:48.979Z [WARNING]: node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
                                    node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
2024-01-14T16:14:48.979Z [WARNING]: Failed installing default packages. Please check if your default-packages file or a package in it has problems!
2024-01-14T16:14:48.980Z [INFO]: # Executing command: nvm use 20
2024-01-14T16:14:49.436Z [INFO]: Now using node v20.11.0 (npm v)
2024-01-14T16:14:49.438Z [INFO]: # Executing command: npm ci
2024-01-14T16:14:49.438Z [WARNING]: node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
                                    node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
2024-01-14T16:14:49.439Z [ERROR]: !!! Build failed
2024-01-14T16:14:49.439Z [INFO]: Please read more about Amplify Hosting's support for SSR frameworks to find if your build failure is related to an unsupported feature: https://docs.aws.amazon.com/amplify/latest/userguide/amplify-ssr-framework-support.html. You may also find this troubleshooting guide useful: https://docs.aws.amazon.com/amplify/latest/userguide/troubleshooting-ssr-deployment.html
2024-01-14T16:14:49.439Z [ERROR]: !!! Non-Zero Exit Code detected
2024-01-14T16:14:49.439Z [INFO]: # Starting environment caching...
2024-01-14T16:14:49.439Z [INFO]: # Environment caching completed
Terminating logging...

这是我的 amplify.yml:

version: 1
backend:
  phases:
    build:
      commands:
        - nvm install 20
        - nvm use 20
        - npm ci
        - npx amplify pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

我相信在将 nextjs 更新到最新稳定版本(^14.0.4)后我得到了这个解决方案

您还可以查看本项目的源代码

如有任何帮助,我们将不胜感激

javascript amazon-web-services next.js aws-amplify glibc
1个回答
0
投票

我自己也遇到过这个!

Amplify 的默认版本似乎是 Amazon Linux 2。事实证明,这对于 Node 18+ 来说有点太旧了。

因此,进入您的 Amplify 项目 -> 应用程序设置 -> 构建设置。向下滚动到构建图像设置。编辑然后将构建映像设置为 Amazon Linux 2023。

来源:aws amplify Github 项目中的问题,他们对此进行了解释

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