簡體   English   中英

AWS放大問題上的NextJS部署(前端+不兼容的模塊)

[英]NextJS deployment on AWS amplify issue (frontend + incompatible module)

我通過連接github repo來部署nextjs項目,provision通過,后端構建,但是前端構建失敗。 這是帶有錯誤的日志:

                                 # Starting phase: preBuild
                                 # Executing command: yarn install
2021-12-13T06:55:51.568Z [INFO]: yarn install v1.22.0
2021-12-13T06:55:51.620Z [INFO]: [1/4] Resolving packages...
2021-12-13T06:55:51.815Z [INFO]: [2/4] Fetching packages...
2021-12-13T06:56:02.529Z [WARNING]: error next@12.0.7: The engine "node" is incompatible with this module. Expected version ">=12.22.0". Got "12.21.0"
2021-12-13T06:56:02.537Z [WARNING]: error Found incompatible module.
2021-12-13T06:56:02.538Z [INFO]: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2021-12-13T06:56:02.550Z [ERROR]: !!! Build failed
2021-12-13T06:56:02.552Z [ERROR]: !!! Non-Zero Exit Code detected
2021-12-13T06:56:02.552Z [INFO]: # Starting environment caching...
2021-12-13T06:56:02.552Z [INFO]: # Environment caching completed
Terminating logging...

構建設置:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

我真的不知道如何解決這個問題,是 AWS 問題還是我的項目有過時的包? 任何幫助,將不勝感激。

要解決此問題,您必須告訴 Amplify 使用哪個版本的 NodeJS。

Go To: Build Settings 底部是 Edit Build image settings 點擊 Add Package Overide

設置你的 NodeJS 版本

這對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM