Seems like I’m having a bit of an issue. I can build my site perfectly on my local machine, but when building on netlify, it fails, with the same error.
– On second not it seems like this might have occured after I added gatsby-source-filesystem. Upon further research it seems like this might be an issue with not being able to access images through a relative path, something that I am using and planning to use a lot more in the future. Is there something that I need to do to make this work with netlify?
Here is my local build:
$ gatsby build
success open and validate gatsby-configs - 0.033s
success load plugins - 1.180s
success onPreInit - 0.049s
success delete html and css files from previous builds - 0.012s
success initialize cache - 0.006s
success copy gatsby files - 0.264s
success onPreBootstrap - 0.026s
success createSchemaCustomization - 0.068s
success Contentful: Fetch data (ntq81mtdi1cj-master) - 0.328s
info Updated entries 0
info Deleted entries 0
info Updated assets 0
info Deleted assets 0
success Contentful: Proccess data (ntq81mtdi1cj-master) - 0.037s
info Creating 2 Contentful Blog Post nodes
info Creating 1 Contentful Author nodes
info Creating 1 Contentful Category nodes
info Creating 1 Contentful Contact info nodes
info Creating 7 Contentful asset nodes
success Contentful: Create nodes (ntq81mtdi1cj-master) - 0.029s
success Checking for changed pages - 0.001s
success source and transform nodes - 2.189s
success building schema - 0.463s
info Total nodes: 338, SitePage nodes: 4 (use --verbose for breakdown)
success createPages - 0.047s
success Checking for changed pages - 0.000s
success createPagesStatefully - 0.114s
success Cleaning up stale page-data - 0.004s
success update schema - 0.038s
success onPreExtractQueries - 0.002s
success extract queries from components - 0.550s
success write out redirect data - 0.006s
success onPostBootstrap - 0.001s
info bootstrap finished - 8.693s
success run page queries - 0.822s - 12/12 14.59/s
success write out requires - 0.014s
success Building production JavaScript and CSS bundles - 15.647s
{
path: '/*',
'*': 'contact',
uri: '/',
location: { pathname: '/contact/', search: '', hash: '' },
navigate: [Function: navigate],
children: undefined,
data: {
site: { siteMetadata: [Object] },
contentfulContactInfo: {
businessLocation: [Object],
businessName: 'Unknown',
email: 'zero@gmail.com',
phoneNumber: 'Unknown'
}
},
pageContext: {},
params: {},
pathContext: {}
}
{ site: { siteMetadata: { title: 'Zero' } }, fileName: null }
{
base64: 'data:image/png;base64,iVBORw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jdjJ0dFc9fvvPjy8c/nR/+3E88WwwdFfitHLeeoJci5LTgzIhODcBr455Gllut+PuL8htbybO72S92yx9saCenr54/O3rxdvf51tRxOwblPJgN3Cn5bsTphQgxLWAZkOfbk0JvTtmpK/1acDPDthxmCs6ajwpbTFboGPRGHy6hqJEZC6lkRYIyqXLK2xz3VIFehyKIDvy2ELgBGLOQlN13ESJwAIHd7CZGfL+fwnqI0iPoLx7exyDHK5ooAAAAAElFTkSuQmCC',
aspectRatio: 1,
src: '/static/ba3352b961697783c21164e17717dd59/030e9/1234.png',
srcSet: '/static/ba3352b961697783c21164e17717dd59/0ce16/1234.png 95w,\n' +
'/static/ba3352b961697783c21164e17717dd59/37f8d/1234.png 190w,\n' +
'/static/ba3352b961697783c21164e17717dd59/030e9/1234.png 380w,\n' +
'/static/ba3352b961697783c21164e17717dd59/fa36e/1234.png 400w',
sizes: '(max-width: 380px) 100vw, 380px'
}
success Building static HTML for pages - 4.774s - 12/12 2.51/s
success onPostBuild - 0.001s
info Done building in 31.1316947 sec
Here’s when I build on netlify and it fails:
10:35:17 AM: Build ready to start
10:35:19 AM: build-image version: 253f72909528f25a82c4640ca58f2e974d52abd9
10:35:19 AM: build-image tag: v3.4.4
10:35:19 AM: buildbot version: 9319377401b48c5db16b3a7910b25af0524f548a
10:35:19 AM: Fetching cached dependencies
10:35:19 AM: Starting to download cache of 269.7MB
10:35:21 AM: Finished downloading cache in 1.512262132s
10:35:21 AM: Starting to extract cache
10:35:33 AM: Finished extracting cache in 12.042592273s
10:35:33 AM: Finished fetching cache in 13.649795291s
10:35:33 AM: Starting to prepare the repo for build
10:35:33 AM: Preparing Git Reference refs/heads/master
10:35:35 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
10:35:36 AM: Starting build script
10:35:36 AM: Installing dependencies
10:35:36 AM: Python version set to 2.7
10:35:36 AM: Started restoring cached node version
10:35:41 AM: Finished restoring cached node version
10:35:41 AM: Attempting node version '13.13.0' from .nvmrc
10:35:42 AM: v13.13.0 is already installed.
10:35:42 AM: Now using node v13.13.0 (npm v6.14.4)
10:35:43 AM: Started restoring cached build plugins
10:35:43 AM: Finished restoring cached build plugins
10:35:43 AM: Attempting ruby version 2.7.1, read from environment
10:35:45 AM: Using ruby version 2.7.1
10:35:45 AM: Using PHP version 5.6
10:35:45 AM: 5.2 is already installed.
10:35:45 AM: Using Swift version 5.2
10:35:45 AM: Started restoring cached node modules
10:35:45 AM: Finished restoring cached node modules
10:35:46 AM: Installing NPM modules using NPM version 6.14.4
10:36:34 AM: > bufferutil@4.0.2 install /opt/build/repo/node_modules/bufferutil
10:36:34 AM: > node-gyp-build
10:36:34 AM: > utf-8-validate@5.0.3 install /opt/build/repo/node_modules/utf-8-validate
10:36:34 AM: > node-gyp-build
10:36:35 AM: > gatsby-telemetry@1.3.40 postinstall /opt/build/repo/node_modules/gatsby-telemetry
10:36:35 AM: > node src/postinstall.js || true
10:36:35 AM: > gatsby-cli@2.12.117 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
10:36:35 AM: > node scripts/postinstall.js
10:36:35 AM: > gatsby@2.25.4 postinstall /opt/build/repo/node_modules/gatsby
10:36:35 AM: > node scripts/postinstall.js
10:36:35 AM: > gatsby-contentful-starter@1.0.0 postinstall /opt/build/repo
10:36:35 AM: > node ./bin/hello.js
10:36:36 AM: Hey there! 👋
10:36:36 AM: Thanks for giving the gatsby-contentful-starter a try. 🎉
10:36:36 AM: To get you going really quickly this project includes a setup step.
10:36:36 AM: yarn run setup automates the following steps for you:
10:36:36 AM: - creates a config file ./.contentful.json
10:36:36 AM: - imports a predefined content model
10:36:36 AM: When this is done run:
10:36:36 AM: yarn run dev to start a development environment at localhost:8000
10:36:36 AM: or
10:36:36 AM: yarn run build to create a production ready static site in ./public
10:36:36 AM: For further information check the readme of the project
10:36:36 AM: (https://github.com/contentful-userland/gatsby-contentful-starter)
10:36:41 AM: npm WARN react-google-maps@9.4.5 requires a peer of @types/googlemaps@^3.0.0 but none is installed. You must install peer dependencies yourself.
10:36:41 AM: npm WARN react-google-maps@9.4.5 requires a peer of @types/markerclustererplus@^2.1.29 but none is installed. You must install peer dependencies yourself.
10:36:41 AM: npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
10:36:41 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
10:36:41 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:36:41 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
10:36:41 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:36:41 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/react-scripts/node_modules/fsevents):
10:36:41 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:36:41 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/react-scripts/node_modules/chokidar/node_modules/fsevents):
10:36:41 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:36:41 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
10:36:41 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:36:41 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
10:36:41 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:36:41 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/babel-plugin-add-module-exports/node_modules/fsevents):
10:36:41 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:36:41 AM: added 260 packages from 132 contributors, removed 448 packages, updated 173 packages and audited 3598 packages in 53.611s
10:36:45 AM: 180 packages are looking for funding
10:36:45 AM: run `npm fund` for details
10:36:45 AM: found 14 vulnerabilities (2 low, 12 high)
10:36:45 AM: run `npm audit fix` to fix them, or `npm audit` for details
10:36:45 AM: NPM modules installed
10:36:46 AM: Started restoring cached go cache
10:36:46 AM: Finished restoring cached go cache
10:36:46 AM: go version go1.14.4 linux/amd64
10:36:46 AM: go version go1.14.4 linux/amd64
10:36:46 AM: Installing missing commands
10:36:46 AM: Verify run directory
10:36:47 AM:
10:36:47 AM: ┌─────────────────────────────┐
10:36:47 AM: │ Netlify Build │
10:36:47 AM: └─────────────────────────────┘
10:36:47 AM:
10:36:47 AM: ❯ Version
10:36:47 AM: @netlify/build 5.2.1
10:36:47 AM:
10:36:47 AM: ❯ Flags
10:36:47 AM: deployId: 5fad01d5ff15b50007277138
10:36:47 AM: mode: buildbot
10:36:47 AM:
10:36:47 AM: ❯ Current directory
10:36:47 AM: /opt/build/repo
10:36:47 AM:
10:36:47 AM: ❯ Config file
10:36:47 AM: No config file was defined: using default values.
10:36:47 AM:
10:36:47 AM: ❯ Context
10:36:47 AM: production
10:36:47 AM:
10:36:47 AM: ┌───────────────────────────────────┐
10:36:47 AM: │ 1. Build command from Netlify app │
10:36:47 AM: └───────────────────────────────────┘
10:36:47 AM:
10:36:47 AM: $ gatsby build
10:36:52 AM: success open and validate gatsby-configs - 0.043s
10:36:53 AM: success load plugins - 1.613s
10:36:53 AM: success onPreInit - 0.051s
10:36:53 AM: success delete html and css files from previous builds - 0.004s
10:36:53 AM: success initialize cache - 0.008s
10:36:53 AM: success copy gatsby files - 0.062s
10:36:54 AM: success onPreBootstrap - 0.023s
10:36:54 AM: success createSchemaCustomization - 0.013s
10:36:55 AM: success Contentful: Fetch data (ntq81mtdi1cj-master) - 0.317s
10:36:55 AM: info Updated entries 5
10:36:55 AM: info Deleted entries 0
10:36:55 AM: info Updated assets 7
10:36:55 AM: info Deleted assets 0
10:36:55 AM: success Contentful: Proccess data (ntq81mtdi1cj-master) - 0.032s
10:36:55 AM: info Creating 2 Contentful Blog Post nodes
10:36:55 AM: info Creating 1 Contentful Author nodes
10:36:55 AM: info Creating 1 Contentful Category nodes
10:36:55 AM: info Creating 1 Contentful Contact info nodes
10:36:55 AM: info Creating 7 Contentful asset nodes
10:36:55 AM: success Contentful: Create nodes (ntq81mtdi1cj-master) - 0.040s
10:36:55 AM: success Checking for changed pages - 0.000s
10:36:55 AM: success source and transform nodes - 1.083s
10:36:56 AM: success building schema - 0.942s
10:36:56 AM: info Total nodes: 336, SitePage nodes: 4 (use --verbose for breakdown)
10:36:56 AM: success createPages - 0.089s
10:36:56 AM: success Checking for changed pages - 0.000s
10:36:56 AM: success createPagesStatefully - 0.124s
10:36:56 AM: success update schema - 0.047s
10:36:56 AM: success onPreExtractQueries - 0.002s
10:36:57 AM: success extract queries from components - 1.028s
10:36:57 AM: success write out redirect data - 0.002s
10:36:57 AM: success onPostBootstrap - 0.001s
10:36:57 AM: info bootstrap finished - 9.674s
10:37:00 AM: success run page queries - 2.829s - 12/12 4.24/s
10:37:00 AM: success write out requires - 0.007s
10:38:11 AM: success Building production JavaScript and CSS bundles - 71.175s
10:38:11 AM: success Rewriting compilation hashes - 0.003s
10:38:20 AM: failed Building static HTML for pages - 8.804s
10:38:20 AM: error Building static HTML failed for path "/about/"
10:38:20 AM:
10:38:20 AM: 42 | className="img"
10:38:20 AM: 43 | style={{ maxHeight: '450px', maxWidth: '450px' }}
10:38:20 AM: > 44 | fluid={imageAuthor.childImageSharp.fluid}
10:38:20 AM: | ^
10:38:20 AM: 45 | />
10:38:20 AM: 46 | </Link>
10:38:20 AM: 47 | </div>
10:38:20 AM:
10:38:20 AM: WebpackError: TypeError: Cannot read property 'childImageSharp' of null
10:38:20 AM:
10:38:20 AM: - team.js:44
10:38:20 AM: src/components/data/team.js:44:48
10:38:20 AM:
10:38:20 AM:
10:38:20 AM: not finished Generating image thumbnails - 83.169s
10:38:20 AM:
10:38:20 AM: ┌─────────────────────────────┐
10:38:20 AM: │ "build.command" failed │
10:38:20 AM: └─────────────────────────────┘
10:38:20 AM:
10:38:20 AM: Error message
10:38:20 AM: Command failed with exit code 1: gatsby build
10:38:20 AM:
10:38:20 AM: Error location
10:38:20 AM: In Build command from Netlify app:
10:38:20 AM: gatsby build
10:38:20 AM:
10:38:20 AM: Resolved config
10:38:20 AM: build:
10:38:20 AM: command: gatsby build
10:38:20 AM: commandOrigin: ui
10:38:20 AM: environment:
10:38:20 AM: - CONTENTFUL_ACCESS_TOKEN
10:38:20 AM: - CONTENTFUL_SPACE_ID
10:38:20 AM: - GOOGLE_ANALYTICS_TRACKING_ID
10:38:20 AM: publish: /opt/build/repo/public
10:38:21 AM: Caching artifacts
10:38:21 AM: Started saving node modules
10:38:21 AM: Finished saving node modules
10:38:21 AM: Started saving build plugins
10:38:21 AM: Finished saving build plugins
10:38:21 AM: Started saving pip cache
10:38:21 AM: Finished saving pip cache
10:38:21 AM: Started saving emacs cask dependencies
10:38:21 AM: Finished saving emacs cask dependencies
10:38:21 AM: Started saving maven dependencies
10:38:21 AM: Finished saving maven dependencies
10:38:21 AM: Started saving boot dependencies
10:38:21 AM: Finished saving boot dependencies
10:38:21 AM: Started saving go dependencies
10:38:21 AM: Finished saving go dependencies
10:38:21 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:38:21 AM: Failing build: Failed to build site
10:38:21 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
10:38:21 AM: Finished processing build request in 3m1.751467745s
I saw a similar issue to the one I have here, so I followed along and updated the packages, both updating the gatsby-cli and running npm update - and then pushed it to github.
Picture of build settings:
Here is my package.json
{
"name": "gatsby-contentful-starter",
"description": "Starter Contentful Gatsby Blog",
"version": "1.0.0",
"author": "Stefan Judis <stefanjudis@gmail.com>",
"bugs": {
"url": "https://github.com/contentful-userland/gatsby-contentful-starter/issues"
},
"dependencies": {
"@contentful/rich-text-react-renderer": "^14.1.2",
"@contentful/rich-text-types": "^14.1.2",
"chart.js": "2.9.3",
"eslint-plugin-flowtype": "3.13.0",
"gatsby-image": "^2.4.21",
"gatsby-plugin-google-analytics": "^2.4.1",
"gatsby-plugin-react-helmet": "^3.3.14",
"gatsby-plugin-root-import": "^2.0.5",
"gatsby-plugin-sass": "^2.4.2",
"gatsby-plugin-sharp": "^2.7.1",
"gatsby-source-contentful": "^2.3.56",
"gatsby-source-filesystem": "^2.4.2",
"gatsby-transformer-remark": "^2.9.2",
"gatsby-transformer-sharp": "^2.5.21",
"headroom.js": "0.11.0",
"lodash": "^4.17.15",
"moment": "2.24.0",
"node-sass": "4.14.0",
"nouislider": "14.2.0",
"react": "^16.14.0",
"react-bootstrap-switch": "15.5.3",
"react-chartjs-2": "2.9.0",
"react-datetime": "2.16.3",
"react-dom": "^16.14.0",
"react-google-maps": "9.4.5",
"react-helmet": "^6.0.0",
"react-icons": "^3.11.0",
"react-router": "5.1.2",
"react-router-dom": "5.1.2",
"react-scripts": "3.4.1",
"react-select": "3.1.0",
"react-slick": "0.25.2",
"react-tagsinput": "3.19.0",
"reactstrap": "8.4.1",
"sharp": "^0.25.2",
"typeface-poppins": "^1.1.13"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"chalk": "^4.0.0",
"contentful-import": "^7.9.18",
"dotenv": "^8.2.0",
"eslint": "^6.8.0",
"eslint-plugin-react": "^7.21.5",
"gatsby": "^2.25.4",
"gh-pages": "^2.2.0",
"inquirer": "^7.1.0",
"prettier": "^2.1.2",
"rimraf": "^3.0.2",
"yargs-parser": "^18.1.3"
},
"engines": {
"node": ">=10.13.0"
},
"homepage": "https://github.com/contentful-userland/gatsby-contentful-starter#readme",
"keywords": [
"gatsby",
"contentful"
],
"license": "MIT",
"main": "n/a",
"repository": {
"type": "git",
"url": "git+https://github.com/contentful-userland/gatsby-contentful-starter.git"
},
"scripts": {
"dev": "npm run develop",
"develop": "gatsby develop",
"lint": "eslint --ext .js,.jsx --ignore-pattern public .",
"test": "echo \"Error: no test specified\" && exit 1",
"format": "prettier --trailing-comma es5 --no-semi --single-quote --write 'src/**/*.js' 'src/**/*.md' 'bin/*.js'",
"build": "gatsby build",
"deploy": "gatsby build --prefix-paths && gh-pages -d public",
"fix-semi": "eslint --quiet --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix *.js bin/*.js",
"postinstall": "node ./bin/hello.js",
"setup": "node ./bin/setup.js",
"start": "npm run develop",
"heroku-postbuild": "gatsby build",
"cleanup-repository": "yarn remove contentful-import chalk inquirer && node ./bin/cleanup.js && rimraf bin contentful"
}
}
Once again, I’m new to netlify, so it might just be simple error on my side. But it’s weird that it is not working, since I’ve tried multiple times.
Would highly appreciate any form of help that I could get!!
Please to take a look at the second paragraph from the top to understand the issue I have better!!
Repo is at GitHub - tornvallalexander/alextorn (editing on mobile).