Build Netlify生成失败,退出代码为非零:1

Build Netlify生成失败,退出代码为非零:1,build,netlify,Build,Netlify,我正试图通过GitHub在Netlify上托管我的站点,但是我收到了一个错误。它是用香草JS、HTML和CSS构建的。我收到了一个退出代码:254,但随后我创建了一个package.json文件,现在我收到了退出代码:1。我在开发模式下运行我的网站时没有问题。我看过各种各样的问题和答案,但是我还没有找到解决办法 我怎样才能解决这个问题 部署日志 9:02:16 PM: Build ready to start 9:02:19 PM: build-image version: 6b66e79d54

我正试图通过GitHub在Netlify上托管我的站点,但是我收到了一个错误。它是用香草JS、HTML和CSS构建的。我收到了一个退出代码:254,但随后我创建了一个package.json文件,现在我收到了退出代码:1。我在开发模式下运行我的网站时没有问题。我看过各种各样的问题和答案,但是我还没有找到解决办法

我怎样才能解决这个问题

部署日志

9:02:16 PM: Build ready to start
9:02:19 PM: build-image version: 6b66e79d54a8f76b01392124644c3052ac0d32ef
9:02:19 PM: build-image tag: v3.3.6
9:02:19 PM: buildbot version: 2ba6f2db8150441c8469e6ae3ab3561a2c9d03fa
9:02:19 PM: Fetching cached dependencies
9:02:19 PM: Starting to download cache of 254.9KB
9:02:19 PM: Finished downloading cache in 67.429279ms
9:02:19 PM: Starting to extract cache
9:02:19 PM: Failed to fetch cache, continuing with build
9:02:19 PM: Starting to prepare the repo for build
9:02:19 PM: No cached dependencies found. Cloning fresh repo
9:02:19 PM: git clone https://github.com/Rahni1/App-Dev-Portfolio
9:02:21 PM: Preparing Git Reference refs/heads/master
9:02:22 PM: Starting build script
9:02:22 PM: Installing dependencies
9:02:23 PM: v10.19.0 is already installed.
9:02:24 PM: Now using node v10.19.0 (npm v6.13.4)
9:02:24 PM: Attempting ruby version 2.6.2, read from environment
9:02:25 PM: Using ruby version 2.6.2
9:02:25 PM: Using PHP version 5.6
9:02:25 PM: Started restoring cached node modules
9:02:25 PM: Finished restoring cached node modules
9:02:26 PM: Installing NPM modules using NPM version 6.13.4
9:02:26 PM: npm
9:02:26 PM:  notice created a lockfile as package-lock.json. You should commit this file.
9:02:26 PM: npm WARN
9:02:26 PM:  portfolio@1.0.0 No description
9:02:27 PM: up to date in 0.347s
9:02:27 PM: found 0 vulnerabilities
9:02:27 PM: NPM modules installed
9:02:27 PM: Started restoring cached go cache
9:02:27 PM: Finished restoring cached go cache
9:02:27 PM: unset GOOS;
9:02:27 PM: unset GOARCH;
9:02:27 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
9:02:27 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
9:02:27 PM: go version >&2;
9:02:27 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
9:02:27 PM: go version go1.12 linux/amd64
9:02:27 PM: Installing missing commands
9:02:27 PM: Verify run directory
9:02:27 PM: Executing user command: npm run build
9:02:27 PM: npm
9:02:27 PM: ERR!
9:02:27 PM:  missing script: build
9:02:27 PM: npm
9:02:27 PM: ERR! A complete log of this run can be found in:
9:02:27 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-03-10T20_02_27_867Z-debug.log
9:02:27 PM: Skipping functions preparation step: no functions directory set
9:02:27 PM: Caching artifacts
9:02:27 PM: Started saving node modules
9:02:27 PM: Finished saving node modules
9:02:27 PM: Started saving pip cache
9:02:27 PM: Finished saving pip cache
9:02:27 PM: Started saving emacs cask dependencies
9:02:27 PM: Finished saving emacs cask dependencies
9:02:27 PM: Started saving maven dependencies
9:02:27 PM: Finished saving maven dependencies
9:02:27 PM: Started saving boot dependencies
9:02:28 PM: Finished saving boot dependencies
9:02:28 PM: Started saving go dependencies
9:02:28 PM: Finished saving go dependencies
9:02:30 PM: Error running command: Build script returned non-zero exit code: 1
9:02:30 PM: Failing build: Failed to build site
9:02:30 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
9:02:30 PM: Finished processing build request in 11.684569294s
Package.json

{
  "name": "portfolio",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/Rahni1/App-Dev-Portfolio.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://link-to-github-repo/issues"
  },
  "homepage": "https://link-to-github-repo#readme"
}

Netlify尝试运行npm运行构建。您的package.json不包含这样的脚本,您需要添加一个脚本,然后重试。

我不确定它是否有帮助,但请尝试将您的build命令更改为 CI=npm运行构建