Как развернуть сайт gatsby на netlify, если он вложен в папку внутри репо? - PullRequest
1 голос
/ 03 октября 2019

Мне нужно развернуть сайт gatsby на netlify для моего университета. У меня есть репозиторий на gitlab с двумя подпапками, обе являются отдельными проектами gatsby. Развертывание завершается неудачей, я думаю, потому что оно пытается развернуть главную папку, которая не является проектом gatsby. Я вставил «npm run build» для команды «Build» и «gatsbyjs-starter-tailwindplay / public» в каталог публикации. Это правильный способ сказать netlify, что он должен развернуть папку gatsbyjs-starter-tailwindplay, а gatsbyjs-starter-tailwindplay является одной из подпапок репозитория?

Я получаю следующий журнал развертывания:

10:52:27 PM: Build ready to start
10:52:29 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
10:52:29 PM: build-image tag: v3.3.2
10:52:29 PM: buildbot version: 16db6527b4cafa2553c3f3f11aa8d1b46a72ff40
10:52:30 PM: Fetching cached dependencies
10:52:30 PM: Failed to fetch cache, continuing with build
10:52:30 PM: Starting to prepare the repo for build
10:52:31 PM: No cached dependencies found. Cloning fresh repo
10:52:31 PM: git clone git@gitlab.com:[deleted by me!]
10:52:32 PM: Preparing Git Reference refs/heads/master
10:52:32 PM: Found netlify.toml. Overriding site configuration
10:52:32 PM: Starting build script
10:52:32 PM: Installing dependencies
10:52:34 PM: Downloading and installing node v10.16.3...
10:52:34 PM: Downloading https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz...
10:52:34 PM: 
#####
10:52:34 PM:                                  7.6%
10:52:34 PM: 
#########################################
10:52:34 PM: ########################         90.4%
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: #
10:52:34 PM: ########################
10:52:34 PM: ############ 100.0%
10:52:34 PM: Computing checksum with sha256sum
10:52:35 PM: Checksums matched!
10:52:37 PM: Now using node v10.16.3 (npm v6.9.0)
10:52:37 PM: Attempting ruby version 2.6.2, read from environment
10:52:39 PM: Using ruby version 2.6.2
10:52:39 PM: Using PHP version 5.6
10:52:39 PM: Started restoring cached node modules
10:52:39 PM: Finished restoring cached node modules
10:52:39 PM: Installing NPM modules using NPM version 6.9.0
10:53:08 PM: > sharp@0.22.1 install /opt/build/repo/gatsbyjs-starter-tailwindplay/node_modules/sharp
10:53:08 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
10:53:09 PM: info
10:53:09 PM: sharp
10:53:09 PM:  Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.4/libvips-8.7.4-linux-x64.tar.gz
10:53:11 PM: > core-js@2.6.9 postinstall /opt/build/repo/gatsbyjs-starter-tailwindplay/node_modules/core-js
10:53:11 PM: > node scripts/postinstall || echo "ignore"
10:53:11 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
10:53:11 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
10:53:11 PM: > https://opencollective.com/core-js 
10:53:11 PM: > https://www.patreon.com/zloirock 
10:53:11 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
10:53:11 PM: > core-js-pure@3.1.4 postinstall /opt/build/repo/gatsbyjs-starter-tailwindplay/node_modules/core-js-pure
10:53:11 PM: > node scripts/postinstall || echo "ignore"
10:53:11 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
10:53:11 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
10:53:11 PM: > https://opencollective.com/core-js 
10:53:11 PM: > https://www.patreon.com/zloirock 
10:53:11 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
10:53:12 PM: > gatsby-telemetry@1.1.0 postinstall /opt/build/repo/gatsbyjs-starter-tailwindplay/node_modules/gatsby-telemetry
10:53:12 PM: > node src/postinstall.js
10:53:14 PM: npm
10:53:14 PM:  WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
10:53:14 PM: npm
10:53:14 PM:  WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:53:14 PM: added 1591 packages from 877 contributors and audited 21387 packages in 33.175s
10:53:14 PM: found 529 vulnerabilities (527 high, 2 critical)
10:53:14 PM:   run `npm audit fix` to fix them, or `npm audit` for details
10:53:14 PM: NPM modules installed
10:53:14 PM: Started restoring cached go cache
10:53:14 PM: Finished restoring cached go cache
10:53:14 PM: unset GOOS;
10:53:14 PM: unset GOARCH;
10:53:14 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
10:53:14 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
10:53:14 PM: go version >&2;
10:53:14 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
10:53:14 PM: go version go1.12 linux/amd64
10:53:14 PM: Installing missing commands
10:53:14 PM: Verify run directory
10:53:14 PM: Executing user command: npm run build
10:53:14 PM: > @oddstronaut/gatsby-starter-tailwind@3.0.25 build /opt/build/repo/gatsbyjs-starter-tailwindplay
10:53:14 PM: > yarn run clean && gatsby build
10:53:14 PM: sh: 1: yarn: not found
10:53:14 PM: npm
10:53:14 PM:  ERR! file sh
10:53:14 PM: npm ERR! code ELIFECYCLE
10:53:14 PM: npm ERR! errno
10:53:14 PM:  ENOENT
10:53:14 PM: npm ERR! syscall spawn
10:53:14 PM: npm
10:53:14 PM:  ERR! @oddstronaut/gatsby-starter-tailwind@3.0.25 build: `yarn run clean && gatsby build`
10:53:14 PM: npm ERR! spawn ENOENT
10:53:14 PM: npm ERR!
10:53:14 PM: npm ERR! Failed at the @oddstronaut/gatsby-starter-tailwind@3.0.25 build script.
10:53:14 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:53:14 PM: npm
10:53:14 PM:  ERR! A complete log of this run can be found in:
10:53:14 PM: npm ERR!
10:53:14 PM:      /opt/buildhome/.npm/_logs/2019-10-03T20_53_14_985Z-debug.log
10:53:14 PM: Skipping functions preparation step: no functions directory set
10:53:14 PM: Caching artifacts
10:53:14 PM: Started saving node modules
10:53:15 PM: Finished saving node modules
10:53:15 PM: Started saving pip cache
10:53:15 PM: Finished saving pip cache
10:53:15 PM: Started saving emacs cask dependencies
10:53:15 PM: Finished saving emacs cask dependencies
10:53:15 PM: Started saving maven dependencies
10:53:15 PM: Finished saving maven dependencies
10:53:15 PM: Started saving boot dependencies
10:53:15 PM: Finished saving boot dependencies
10:53:15 PM: Started saving go dependencies
10:53:15 PM: Finished saving go dependencies
10:53:17 PM: Error running command: Build script returned non-zero exit code: 1
10:53:17 PM: Failing build: Failed to build site
10:53:17 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
10:53:18 PM: Finished processing build request in 48.202499427s

Root:

However if I go into the gatsbyjs-starter-tailwindplay folder there is no public folder, but it is definitely there in my cloned repo on my PC!

Однако, если я зайду в папку gatsbyjs-starter-tailwindplay, то нетобщая папка, но она определенно есть в моем клонированном репо на моем компьютере! Не слишком опытный с git, это должно быть. То же самое относится и к репо с начальной страницей Гэтсби по умолчанию, которую я могу развернуть очень хорошо, так что я думаю, что так и должно быть?!

Ответы [ 2 ]

0 голосов
/ 15 октября 2019

Я столкнулся с той же проблемой, поэтому использовал подмодули .

Но Netlify только что запустил эту функцию.

0 голосов
/ 03 октября 2019

Что произойдет, если вы добавите файл netlify.toml в корень своего хранилища?

# Settings in the [build] context are global and are applied to all contexts
# unless otherwise overridden by more specific contexts.
[build]
  # Directory to change to before starting a build.
  # This is where we will look for package.json/.nvmrc/etc.
  base = "gatsbyjs-starter-tailwindplay/"

  # Directory (relative to root of your repo) that contains the deploy-ready
  # HTML files and assets generated by the build. If a base directory has
  # been specified, include it in the publish directory path.
  publish = "gatsbyjs-starter-tailwindplay/public/"

  # Default build command.
  command = "npm run build"

Папки public и .cache создаются в результате сборки gatsbyпроцесс. Они настроены на игнорирование git в файле .gitignore.

...