gpt4 book ai didi

deployment - 部署没有成功 : Deploy directory 'out' does not exist

转载 作者:行者123 更新时间:2023-12-03 19:40:03 28 4
gpt4 key购买 nike

使用Next.js创建的app部署到netlify时,出现如下错误,部署失败。

────────────────────────────────────────────────────────────────
6. Deploy site
────────────────────────────────────────────────────────────────


────────────────────────────────────────────────────────────────
Configuration error
────────────────────────────────────────────────────────────────

Error message
Deploy did not succeed: Deploy directory 'out' does not exist

Resolved config
build:
command: yarn build
commandOrigin: config
publish: /opt/build/repo/out
plugins:
- inputs: {}
origin: config
package: '@netlify/plugin-nextjs'
- inputs: {}
origin: config
package: netlify-plugin-cache-nextjs
Caching artifacts
Started saving node modules
Finished saving node modules
Started saving build plugins
Finished saving build plugins
Started saving yarn cache
Finished saving yarn cache
Started saving pip cache
Finished saving pip cache
Started saving emacs cask dependencies
Finished saving emacs cask dependencies
Started saving maven dependencies
Finished saving maven dependencies
Started saving boot dependencies
Finished saving boot dependencies
Started saving rust rustup cache
Finished saving rust rustup cache
Started saving go dependencies
Finished saving go dependencies
Build failed due to a user error: Build script returned non-zero exit code: 2
Failing build: Failed to build site
Failed during stage 'building site': Build script returned non-zero exit code: 2
Finished processing build request in 1m25.310488139s
各种文件和设置如下所示。
netlify.toml
[build]
command = "yarn build"
publish = "out"

[[plugins]]
package = "@netlify/plugin-nextjs"

[[plugins]]
package = "netlify-plugin-cache-nextjs"
package.json
...
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"export": "next export"
},
...
Netlify |build设置
congif
各种设置基于以下页面。
  • Failed during stage 'building site': Deploy directory 'out' does not exist - Support - Netlify Community
  • Next.js on Netlify | Netlify Docs

  • 如果你知道如何解决这个问题,请告诉我。
    我愿意接受任何想法。

    最佳答案

    您在 yarn export 文件内的构建命令中缺少 netlify.toml。由于 next export 不会被调用,因此 out/ 文件夹将不存在。

    [build]
    command = "yarn build && yarn export"
    publish = "out"

    ...

    关于deployment - 部署没有成功 : Deploy directory 'out' does not exist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66353549/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com