我尝试在 AWS Amplify 中部署我的 NextJs 应用程序,但没有成功。
我的package.json如下:
{
"name": "bytecho",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@next/font": "^14.0.1",
"next": "14.0.1",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.1",
"postcss": "^8",
"tailwindcss": "^3.3.0",
"typescript": "^5"
}
}
我的amplify.yml:
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- next build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
但是,在构建时,我收到以下错误:
有谁知道可以采取什么措施来解决这个问题?
尝试切换到 2023 服务器(在构建设置下高级)而不是 linux2 服务器;使用您的节点版本应该会更容易。