首页 > 解决方案 > 与 GitHub (gulp) Netlify 集成的问题

问题描述

从 GitHub 存储库添加站点并进行部署时发生错误:

6:36:32 PM: Build ready to start
6:36:35 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
6:36:35 PM: build-image tag: v3.3.2
6:36:35 PM: buildbot version: ef8d0929ed0baabafd8bbb7d0b021e1fc24180c0
6:36:35 PM: Fetching cached dependencies
6:36:35 PM: Failed to fetch cache, continuing with build
6:36:35 PM: Starting to prepare the repo for build
6:36:36 PM: No cached dependencies found. Cloning fresh repo
6:36:36 PM: git clone https://github.com/Thr0TT1e/huddle_landing_page
6:36:37 PM: Preparing Git Reference refs/heads/master
6:36:37 PM: Found netlify.toml. Overriding site configuration
6:36:37 PM: Starting build script
6:36:37 PM: Installing dependencies
6:36:39 PM: Downloading and installing node v10.16.2...
6:36:40 PM: Downloading https://nodejs.org/dist/v10.16.2/node-v10.16.2-linux-x64.tar.xz...
6:36:40 PM: 
#####
6:36:40 PM:   7.8%
6:36:40 PM: 
###############################################################
6:36:40 PM: ######### 100.0%
6:36:40 PM: Computing checksum with sha256sum
6:36:40 PM: Checksums matched!
6:36:43 PM: Now using node v10.16.2 (npm v6.9.0)
6:36:44 PM: Attempting ruby version 2.6.2, read from environment
6:36:46 PM: Using ruby version 2.6.2
6:36:47 PM: Using PHP version 5.6
6:36:47 PM: Started restoring cached node modules
6:36:47 PM: Finished restoring cached node modules
6:36:47 PM: Installing NPM modules using NPM version 6.9.0
6:36:49 PM: npm
6:36:49 PM: WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
6:36:53 PM: npm WARN deprecated lodash.createcallback@2.4.4: This package is discontinued. Use lodash.iteratee@^4.0.0.
6:37:18 PM: > node-sass@4.12.0 install /opt/build/repo/node_modules/node-sass
6:37:18 PM: > node scripts/install.js
6:37:19 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.12.0/linux-x64-64_binding.node
6:37:21 PM: Download complete
6:37:21 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-64/binding.node
6:37:21 PM: Caching binary to /opt/buildhome/.npm/node-sass/4.12.0/linux-x64-64_binding.node
6:37:21 PM: > node-sass@4.12.0 postinstall /opt/build/repo/node_modules/node-sass
6:37:21 PM: > node scripts/build.js
6:37:22 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-64/binding.node
6:37:22 PM: Testing binary
6:37:22 PM: Binary is fine
6:37:22 PM: > gifsicle@4.0.1 postinstall /opt/build/repo/node_modules/gifsicle
6:37:22 PM: > node lib/install.js
6:37:23 PM:   ✔ gifsicle pre-build test passed successfully
6:37:23 PM: > jpegtran-bin@4.0.0 postinstall /opt/build/repo/node_modules/jpegtran-bin
6:37:23 PM: > node lib/install.js
6:37:24 PM:   ✔ jpegtran pre-build test passed successfully
6:37:24 PM: > optipng-bin@5.1.0 postinstall /opt/build/repo/node_modules/optipng-bin
6:37:24 PM: > node lib/install.js
6:37:24 PM:   ✔ optipng pre-build test passed successfully
6:37:25 PM: npm
6:37:25 PM: notice created a lockfile as package-lock.json. You should commit this file.
6:37:25 PM: npm WARN
6:37:25 PM:  huddle-landing-page@0.0.1 No repository field.
6:37:25 PM: npm WARN optional
6:37:25 PM:  SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
6:37:25 PM: npm WARN
6:37:25 PM: notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
6:37:25 PM: added 925 packages from 552 contributors and audited 14495 packages in 37.17s
6:37:25 PM: found 0 vulnerabilities
6:37:26 PM: NPM modules installed
6:37:26 PM: Started restoring cached go cache
6:37:26 PM: Finished restoring cached go cache
6:37:26 PM: unset GOOS;
6:37:26 PM: unset GOARCH;
6:37:26 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
6:37:26 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
6:37:26 PM: go version >&2;
6:37:26 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
6:37:26 PM: go version go1.12 linux/amd64
6:37:26 PM: Installing missing commands
6:37:26 PM: Verify run directory
6:37:26 PM: Executing user command: gulp build
6:37:28 PM: [15:37:28]
6:37:28 PM: Using gulpfile /opt/build/repo/gulpfile.js
6:37:28 PM: [15:37:28]
6:37:28 PM: Task never defined: build
6:37:28 PM: [15:37:28]
6:37:28 PM: To list available tasks, try running: gulp --tasks
6:37:28 PM: Skipping functions preparation step: no functions directory set
6:37:28 PM: Caching artifacts
6:37:28 PM: Started saving node modules
6:37:28 PM: Finished saving node modules
6:37:28 PM: Started saving pip cache
6:37:28 PM: Finished saving pip cache
6:37:28 PM: Started saving emacs cask dependencies
6:37:28 PM: Finished saving emacs cask dependencies
6:37:28 PM: Started saving maven dependencies
6:37:28 PM: Finished saving maven dependencies
6:37:28 PM: Started saving boot dependencies
6:37:28 PM: Finished saving boot dependencies
6:37:28 PM: Started saving go dependencies
6:37:28 PM: Finished saving go dependencies
6:37:38 PM: Error running command: Build script returned non-zero exit code: 1
6:37:38 PM: Failing build: Failed to build site
6:37:38 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
6:37:38 PM: Finished processing build request in 1m3.374187994s

netlify.toml

# global context
[build]
  publish = "dist"
  command = "gulp build"
# build a preview (optional)
[context.deploy-preview]
  command = "gulp build-preview"
# build a branch with debug (optional)
[context.branch-deploy]
  command = "gulp build-debug"

gulpfile.js - https://github.com/Thr0TT1e/huddle_landing_page/blob/master/gulpfile.js

在 Netlify 上正确构建项目还需要哪些设置?该项目是使用 gulp 构建的,我对大会没有特殊任务。

标签: githubgulpnetlify

解决方案


尝试netlify.toml在项目的根目录中添加一个文件。在文件中添加一个指向根文件的路径。就像是:

[[redirects]]
  from = "/"
  to = "/index.html"
  status = 200

推荐阅读