Как развернуть сайт gatsby на netlify, если он вложен в папку внутри репо?

Мне нужно развернуть сайт 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 [email protected]:[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: > [email protected] 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: > [email protected] 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: > [email protected] 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: > [email protected] 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: [email protected] (node_modules/fsevents):
10:53:14 PM: npm
10:53:14 PM:  WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: 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/[email protected] 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/[email protected] 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/[email protected] 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

Корень:

Однако, если я захожу в папку gatsbyjs-starter-tailwindplay, общедоступной папки нет, но она определенно присутствует в моем клонированном репозитории на моем ПК!

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


person leabum    schedule 03.10.2019    source источник
comment
Возможный дубликат Netlify: Как вы развертывать сайты, вложенные в папку?   -  person ksav    schedule 03.10.2019


Ответы (2)


Что произойдет, если вы добавите файл 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.

person ksav    schedule 03.10.2019
comment
не работает, к сожалению, я добавил журнал развертывания выше - person leabum; 04.10.2019
comment
Не могли бы вы также добавить свой package.json? - person ksav; 04.10.2019

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

Но Netlify только что запустил это особенность.

person Selim Zaouali    schedule 15.10.2019