Cannot get project to build (non-zero exit code: 1)

Netlify site name is mono-pco.netlify.app, but it would not be any good as I cannot deploy a mkdocs on it to be available. Here’s a repository for the project.

The netlify.toml configuration file is as follows:

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 = "pco"

  # 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 = "/build"

  # Default build command.
  command = "mkdocs build --clean"

But deploy log looks like this:

Deploy log
12:17:32 PM: Build ready to start
12:17:34 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
12:17:34 PM: build-image tag: v4.8.0
12:17:34 PM: buildbot version: e58b6be665675c0f99b33132a8c1eec1f775eba1
12:17:34 PM: Fetching cached dependencies
12:17:35 PM: Failed to fetch cache, continuing with build
12:17:35 PM: Starting to prepare the repo for build
12:17:35 PM: No cached dependencies found. Cloning fresh repo
12:17:35 PM: git clone git@github.com:karlisup/monorepo-demo
12:17:37 PM: Preparing Git Reference refs/heads/main
12:17:38 PM: Parsing package.json dependencies
12:17:38 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'pco/public' versus '.' in the Netlify UI
12:17:38 PM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'pco/netlify/functions' versus 'netlify/functions' in the Netlify UI
12:17:38 PM: Starting build script
12:17:38 PM: Installing dependencies
12:17:38 PM: /opt/build-bin/run-build-functions.sh: line 223: /opt/buildhome/python3.7/bin/activate: No such file or directory
12:17:38 PM: Error setting python version from runtime.txt
12:17:38 PM: Creating deploy upload records
12:17:38 PM: Please see https://github.com/netlify/build-image/blob/focal/included_software.md for current versions
12:17:38 PM: Build was terminated: Build script returned non-zero exit code: 1
12:17:39 PM: Failing build: Failed to build site
12:17:39 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
12:17:39 PM: Finished processing build request in 4.543728641s

I can build site locally when cd into pco and executed mkdocs build --clean. I have quite similar site with similar settings and it works :roll_eyes: . Any help would be appreciated.

Just a side-note. I don’t understand why when I remove netlify.toml configuration file then clear cache and retry deploy - in Deploy log I still get text

[…] going to use the one specified in the Netlify configuration file

Hey @karlisup

I see there is a netlify.toml file in the repository inside the pco directory. This file contains the line

base = "pco"

however, as it is in that directory, removing this line is probably advantageous, especially if you have set the base directory as pco in the UI (which I am thinking you might have, otherwise it would try building from the repository root which contains nothing) as is necessary when building from a monorepo or sub-directory.

Thank you for the reply @coelmay.

I see there is a netlify.toml file in the repository inside the pco directory

The case I am talking about was when I removed it and tested it without the netlify.toml. Currently, setup contains netlify.toml.

The idea for the folder pco is to test how to have a monorepo with multiple sub-folders to deploy multiple mkdocs instances. That is why the project is not hosted in the root folder.

This is fine. But you will need to remove the base configuration from the netlify.toml as it is already in that directory i.e.

  base = "pco"

Eureca! Thank you @coelmay!
I got on another python version-related issue but managed to fix it by bumping the version. Thank you! Will go on trying to set up 2 sites from monorepo.

When the site is running, could you please point in a direction where to search - how can I have 2 such sites under different sub-folders like so:
/pco/getting-started/
/pco/faq/
/product2/getting-started/
/product2/faq/

[edit]
Changed mkdocs configuration site_dir from build to build/pco which seems to work as expected. Thank you for taking your time and getting back to me so quickly!

3 Likes

Thanks for coming back and letting us know this works! Happy building :rocket: