未能部署NUXT应用程序来NETLIFY
我正在尝试部署NUXT应用程序,然后逐步遵循Udemy演讲,他们的工作效果,但我的帮助并不感谢。
这是我的netlify config:
,这是我的构建日志
Build Log:
7:00:42 PM: Build ready to start
7:00:44 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
7:00:44 PM: build-image tag: v4.8.0
7:00:44 PM: buildbot version: 17f6c1ab2fe6d61574ce02b038041b816bf6c085
7:00:44 PM: Fetching cached dependencies
7:00:44 PM: Starting to download cache of 676.1KB
7:00:44 PM: Finished downloading cache in 154.455861ms
7:00:44 PM: Starting to extract cache
7:00:44 PM: Finished extracting cache in 13.041304ms
7:00:44 PM: Finished fetching cache in 167.765258ms
7:00:44 PM: Starting to prepare the repo for build
7:00:45 PM: Preparing Git Reference refs/heads/master
7:00:45 PM: Parsing package.json dependencies
7:00:46 PM: Starting build script
7:00:46 PM: Installing dependencies
7:00:46 PM: Python version set to 2.7
7:00:46 PM: Downloading and installing node v16.15.0…
7:00:46 PM: Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz…
7:00:47 PM: Computing checksum with sha256sum
7:00:47 PM: Checksums matched!
7:00:49 PM: Now using node v16.15.0 (npm v8.5.5)
7:00:49 PM: Started restoring cached build plugins
7:00:49 PM: Finished restoring cached build plugins
7:00:49 PM: Attempting ruby version 2.7.2, read from environment
7:00:50 PM: Using ruby version 2.7.2
7:00:50 PM: Using PHP version 8.0
7:00:50 PM: Started restoring cached go cache
7:00:50 PM: Finished restoring cached go cache
7:00:50 PM: go version go1.16.5 linux/amd64
7:00:50 PM: go version go1.16.5 linux/amd64
7:00:50 PM: Installing missing commands
7:00:50 PM: Verify run directory
7:00:52 PM:
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: Netlify Build
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM:
7:00:52 PM: ❯ Version
7:00:52 PM: @netlify/build 27.1.3
7:00:52 PM:
7:00:52 PM: ❯ Flags
7:00:52 PM: baseRelDir: true
7:00:52 PM: buildId: 628a7a075a97cd0e6a54ecf0
7:00:52 PM: deployId: 628a7a075a97cd0e6a54ecf2
7:00:52 PM:
7:00:52 PM: ❯ Current directory
7:00:52 PM: /opt/build/repo
7:00:52 PM:
7:00:52 PM: ❯ Config file
7:00:52 PM: No config file was defined: using default values.
7:00:52 PM:
7:00:52 PM: ❯ Context
7:00:52 PM: production
7:00:52 PM:
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: 1. Build command from Netlify app
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM:
7:00:52 PM: $ npm run generate
7:00:52 PM: npm ERR! code ENOENT
7:00:52 PM: npm ERR! syscall open
7:00:52 PM: npm ERR! path /opt/build/repo/package.json
7:00:52 PM: npm ERR! errno -2
7:00:52 PM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
7:00:52 PM: npm ERR! enoent This is related to npm not being able to find a file.
7:00:52 PM: npm ERR! enoent
7:00:52 PM: npm ERR! A complete log of this run can be found in:
7:00:52 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-05-22T18_00_52_303Z-debug-0.log
7:00:52 PM:
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: “build.command” failed
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM:
7:00:52 PM: Error message
7:00:52 PM: Command failed with exit code 254: npm run generate (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
7:00:52 PM:
7:00:52 PM: Error location
7:00:52 PM: In Build command from Netlify app:
7:00:52 PM: npm run generate
7:00:52 PM:
7:00:52 PM: Resolved config
7:00:52 PM: build:
7:00:52 PM: command: npm run generate
7:00:52 PM: commandOrigin: ui
7:00:52 PM: publish: /opt/build/repo/dist
7:00:52 PM: publishOrigin: ui
7:00:52 PM: Caching artifacts
7:00:52 PM: Started saving build plugins
7:00:53 PM: Finished saving build plugins
7:00:54 PM: Creating deploy upload records
7:00:53 PM: Started saving pip cache
7:00:53 PM: Finished saving pip cache
7:00:53 PM: Started saving emacs cask dependencies
7:00:53 PM: Finished saving emacs cask dependencies
7:00:53 PM: Started saving maven dependencies
7:00:53 PM: Finished saving maven dependencies
7:00:53 PM: Started saving boot dependencies
7:00:53 PM: Finished saving boot dependencies
7:00:53 PM: Started saving rust rustup cache
7:00:54 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
7:00:53 PM: Finished saving rust rustup cache
7:00:53 PM: Started saving go dependencies
7:00:53 PM: Finished saving go dependencies
7:00:54 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:00:54 PM: Failing build: Failed to build site
7:00:54 PM: Finished processing build request in 10.392917083s
I am trying to deploy a Nuxt application and I followed a udemy lecture step by step, theirs worked, but mine is not, any help would be much appreciated.
Here's my netlify config:
And here's my build log
Build Log:
7:00:42 PM: Build ready to start
7:00:44 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
7:00:44 PM: build-image tag: v4.8.0
7:00:44 PM: buildbot version: 17f6c1ab2fe6d61574ce02b038041b816bf6c085
7:00:44 PM: Fetching cached dependencies
7:00:44 PM: Starting to download cache of 676.1KB
7:00:44 PM: Finished downloading cache in 154.455861ms
7:00:44 PM: Starting to extract cache
7:00:44 PM: Finished extracting cache in 13.041304ms
7:00:44 PM: Finished fetching cache in 167.765258ms
7:00:44 PM: Starting to prepare the repo for build
7:00:45 PM: Preparing Git Reference refs/heads/master
7:00:45 PM: Parsing package.json dependencies
7:00:46 PM: Starting build script
7:00:46 PM: Installing dependencies
7:00:46 PM: Python version set to 2.7
7:00:46 PM: Downloading and installing node v16.15.0…
7:00:46 PM: Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz…
7:00:47 PM: Computing checksum with sha256sum
7:00:47 PM: Checksums matched!
7:00:49 PM: Now using node v16.15.0 (npm v8.5.5)
7:00:49 PM: Started restoring cached build plugins
7:00:49 PM: Finished restoring cached build plugins
7:00:49 PM: Attempting ruby version 2.7.2, read from environment
7:00:50 PM: Using ruby version 2.7.2
7:00:50 PM: Using PHP version 8.0
7:00:50 PM: Started restoring cached go cache
7:00:50 PM: Finished restoring cached go cache
7:00:50 PM: go version go1.16.5 linux/amd64
7:00:50 PM: go version go1.16.5 linux/amd64
7:00:50 PM: Installing missing commands
7:00:50 PM: Verify run directory
7:00:52 PM:
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: Netlify Build
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM:
7:00:52 PM: ❯ Version
7:00:52 PM: @netlify/build 27.1.3
7:00:52 PM:
7:00:52 PM: ❯ Flags
7:00:52 PM: baseRelDir: true
7:00:52 PM: buildId: 628a7a075a97cd0e6a54ecf0
7:00:52 PM: deployId: 628a7a075a97cd0e6a54ecf2
7:00:52 PM:
7:00:52 PM: ❯ Current directory
7:00:52 PM: /opt/build/repo
7:00:52 PM:
7:00:52 PM: ❯ Config file
7:00:52 PM: No config file was defined: using default values.
7:00:52 PM:
7:00:52 PM: ❯ Context
7:00:52 PM: production
7:00:52 PM:
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: 1. Build command from Netlify app
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM:
7:00:52 PM: $ npm run generate
7:00:52 PM: npm ERR! code ENOENT
7:00:52 PM: npm ERR! syscall open
7:00:52 PM: npm ERR! path /opt/build/repo/package.json
7:00:52 PM: npm ERR! errno -2
7:00:52 PM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
7:00:52 PM: npm ERR! enoent This is related to npm not being able to find a file.
7:00:52 PM: npm ERR! enoent
7:00:52 PM: npm ERR! A complete log of this run can be found in:
7:00:52 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-05-22T18_00_52_303Z-debug-0.log
7:00:52 PM:
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: “build.command” failed
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM:
7:00:52 PM: Error message
7:00:52 PM: Command failed with exit code 254: npm run generate (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
7:00:52 PM:
7:00:52 PM: Error location
7:00:52 PM: In Build command from Netlify app:
7:00:52 PM: npm run generate
7:00:52 PM:
7:00:52 PM: Resolved config
7:00:52 PM: build:
7:00:52 PM: command: npm run generate
7:00:52 PM: commandOrigin: ui
7:00:52 PM: publish: /opt/build/repo/dist
7:00:52 PM: publishOrigin: ui
7:00:52 PM: Caching artifacts
7:00:52 PM: Started saving build plugins
7:00:53 PM: Finished saving build plugins
7:00:54 PM: Creating deploy upload records
7:00:53 PM: Started saving pip cache
7:00:53 PM: Finished saving pip cache
7:00:53 PM: Started saving emacs cask dependencies
7:00:53 PM: Finished saving emacs cask dependencies
7:00:53 PM: Started saving maven dependencies
7:00:53 PM: Finished saving maven dependencies
7:00:53 PM: Started saving boot dependencies
7:00:53 PM: Finished saving boot dependencies
7:00:53 PM: Started saving rust rustup cache
7:00:54 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
7:00:53 PM: Finished saving rust rustup cache
7:00:53 PM: Started saving go dependencies
7:00:53 PM: Finished saving go dependencies
7:00:54 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:00:54 PM: Failing build: Failed to build site
7:00:54 PM: Finished processing build request in 10.392917083s
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您
target
的另一个值,因此,它正在服用默认值,是server
。此值需要一个node.js服务器可供应用程序运行,因此需要
npm run build
和vps或诸如Heroku/digitalocean等平台等...如果您想能够静态托管它,则需要设置
target:'static'
并使用npm run生成
。这可以在Netlify上成功构建,因为您可以请参阅此处。
You didn't set a different value for
target
, hence it's taking the default, which isserver
.This value requires a Node.js server to be available for the app to run, hence the need for
npm run build
and a VPS or a platform like Heroku/Digitalocean etc...If you want to be able to host it statically, you need to set
target: 'static'
and usenpm run generate
.That allow to a successful build on Netlify as you can see here.