Gatsby: Can't resolve '../../public/static/d/...' on build box, but works locally

Created on 8 Jul 2020  ยท  8Comments  ยท  Source: gatsbyjs/gatsby

Description

After updating my project to the latest gatsby, my builds are failing on Netlify but successful locally. I've seen a few issues that showcases similar results, but their solutions don't seem to be working.

I've updated my build stage to do gatsby clean before gatsby build and also run the deployment as clear cache and deploy site.

Interesting the names for the static json files are different to what's generated locally, but I'm not sure if this is expected.

Steps to reproduce

N/A

Expected result

The build should be successful.

Actual result

The build fails with the following reports

2:09:12 PM: Build ready to start
2:09:14 PM: build-image version: ca811f47d4c1cbd1812d1eb6ecb0c977e86d1a1d
2:09:14 PM: build-image tag: v3.3.20
2:09:14 PM: buildbot version: 78b5536ab4f742c26705d3e953381b9cde6e22ef
2:09:14 PM: Fetching cached dependencies
2:09:14 PM: Failed to fetch cache, continuing with build
2:09:14 PM: Starting to prepare the repo for build
2:09:14 PM: No cached dependencies found. Cloning fresh repo
2:09:14 PM: git clone ***
2:09:15 PM: Preparing Git Reference refs/heads/develop
2:09:16 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
2:09:16 PM: Starting build script
2:09:16 PM: Installing dependencies
2:09:16 PM: Python version set to 2.7
2:09:17 PM: Attempting node version '12.18.2' from .node-version
2:09:18 PM: Downloading and installing node v12.18.2...
2:09:18 PM: Downloading https://nodejs.org/dist/v12.18.2/node-v12.18.2-linux-x64.tar.xz...
2:09:18 PM: Computing checksum with sha256sum
2:09:18 PM: Checksums matched!
2:09:21 PM: Now using node v12.18.2 (npm v6.14.5)
2:09:21 PM: Started restoring cached build plugins
2:09:21 PM: Finished restoring cached build plugins
2:09:21 PM: Attempting ruby version 2.6.2, read from environment
2:09:22 PM: Using ruby version 2.6.2
2:09:22 PM: Using PHP version 5.6
2:09:22 PM: 5.2 is already installed.
2:09:22 PM: Using Swift version 5.2
2:09:22 PM: Started restoring cached node modules
2:09:22 PM: Finished restoring cached node modules
2:09:22 PM: Installing NPM modules using NPM version 6.14.5
2:09:23 PM: > ***@0.1.0 preinstall /opt/build/repo
2:09:23 PM: > npx npm-force-resolutions
2:09:25 PM: npx: installed 5 in 1.442s
2:10:18 PM: > [email protected] install /opt/build/repo/node_modules/sharp
2:10:18 PM: > (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
2:10:19 PM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.9.1/libvips-8.9.1-linux-x64.tar.gz
2:10:21 PM: > [email protected] install /opt/build/repo/node_modules/node-sass
2:10:21 PM: > node scripts/install.js
2:10:21 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-72_binding.node
2:10:22 PM: Download complete
2:10:22 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
2:10:22 PM: Caching binary to /opt/buildhome/.npm/node-sass/4.14.1/linux-x64-72_binding.node
2:10:22 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/bmp/node_modules/core-js
2:10:22 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:22 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/core/node_modules/core-js
2:10:22 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:22 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/custom/node_modules/core-js
2:10:22 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:22 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/gif/node_modules/core-js
2:10:22 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:22 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/jpeg/node_modules/core-js
2:10:22 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:22 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-blit/node_modules/core-js
2:10:22 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:22 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-blur/node_modules/core-js
2:10:22 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-circle/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-color/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-contain/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-cover/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-crop/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-displace/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-dither/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-fisheye/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-flip/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-gaussian/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-invert/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:23 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-mask/node_modules/core-js
2:10:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-normalize/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-print/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-resize/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-rotate/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-scale/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-shadow/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugin-threshold/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/plugins/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/png/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/tiff/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/types/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:24 PM: > [email protected] postinstall /opt/build/repo/node_modules/@jimp/utils/node_modules/core-js
2:10:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:25 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js
2:10:25 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:25 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js-pure
2:10:25 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:25 PM: > [email protected] postinstall /opt/build/repo/node_modules/jimp/node_modules/core-js
2:10:25 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:10:26 PM: > [email protected] postinstall /opt/build/repo/node_modules/gatsby-telemetry
2:10:26 PM: > node src/postinstall.js || true
2:10:26 PM: > [email protected] postinstall /opt/build/repo/node_modules/mozjpeg
2:10:26 PM: > node lib/install.js
2:10:27 PM:   โœ” mozjpeg pre-build test passed successfully
2:10:27 PM: > [email protected] postinstall /opt/build/repo/node_modules/pngquant-bin
2:10:27 PM: > node lib/install.js
2:10:27 PM:   โœ” pngquant pre-build test passed successfully
2:10:27 PM: > [email protected] postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
2:10:27 PM: > node scripts/postinstall.js
2:10:27 PM: > [email protected] postinstall /opt/build/repo/node_modules/gatsby
2:10:27 PM: > node scripts/postinstall.js
2:10:28 PM: > [email protected] postinstall /opt/build/repo/node_modules/node-sass
2:10:28 PM: > node scripts/build.js
2:10:28 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
2:10:28 PM: Testing binary
2:10:28 PM: Binary is fine
2:10:31 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
2:10:31 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:10:31 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/gatsby-source-filesystem/node_modules/fsevents):
2:10:31 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:10:31 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/chokidar/node_modules/fsevents):
2:10:31 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:10:31 PM: added 2409 packages from 1329 contributors and audited 2419 packages in 67.358s
2:10:33 PM: 145 packages are looking for funding
2:10:33 PM:   run `npm fund` for details
2:10:33 PM: found 718 low severity vulnerabilities
2:10:33 PM:   run `npm audit fix` to fix them, or `npm audit` for details
2:10:33 PM: NPM modules installed
2:10:33 PM: Started restoring cached go cache
2:10:33 PM: Finished restoring cached go cache
2:10:33 PM: Installing Go version 1.12
2:10:42 PM: unset GOOS;
2:10:42 PM: unset GOARCH;
2:10:42 PM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
2:10:42 PM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
2:10:42 PM: go version >&2;
2:10:42 PM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env"
2:10:42 PM: go version go1.12 linux/amd64
2:10:42 PM: Installing missing commands
2:10:42 PM: Verify run directory
2:10:43 PM: โ€‹
2:10:43 PM: โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
2:10:43 PM: โ”‚        Netlify Build        โ”‚
2:10:43 PM: โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
2:10:43 PM: โ€‹
2:10:43 PM: โฏ Version
2:10:43 PM:   @netlify/build 2.0.27
2:10:43 PM: โ€‹
2:10:43 PM: โฏ Flags
2:10:43 PM:   deployId: 5f05c57801d6890007961b1a
2:10:43 PM:   mode: buildbot
2:10:43 PM: โ€‹
2:10:43 PM: โฏ Current directory
2:10:43 PM:   /opt/build/repo
2:10:43 PM: โ€‹
2:10:43 PM: โฏ Config file
2:10:43 PM:   No config file was defined: using default values.
2:10:43 PM: โ€‹
2:10:43 PM: โฏ Context
2:10:43 PM:   branch-deploy
2:10:43 PM: โ€‹
2:10:43 PM: โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
2:10:43 PM: โ”‚ 1. Build command from Netlify app โ”‚
2:10:43 PM: โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
2:10:43 PM: โ€‹
2:10:43 PM: $ npm run build
2:10:43 PM: > ***@0.1.0 build /opt/build/repo
2:10:43 PM: > gatsby info --clipboard && gatsby clean && gatsby build
2:10:45 PM: 
2:10:45 PM:   System:
2:10:45 PM:     OS: Linux 4.14 Ubuntu 16.04.6 LTS (Xenial Xerus)
2:10:45 PM:     CPU: (8) x64 Intel(R) Xeon(R) CPU @ 2.30GHz
2:10:45 PM:     Shell: 4.3.48 - /bin/bash
2:10:45 PM:   Binaries:
2:10:45 PM:     Node: 12.18.2 - ~/.nvm/versions/node/v12.18.2/bin/node
2:10:45 PM:     npm: 6.14.5 - ~/.nvm/versions/node/v12.18.2/bin/npm
2:10:45 PM:   Languages:
2:10:45 PM:     Python: 2.7.12 - /opt/buildhome/python2.7/bin/python
2:10:45 PM:   npmPackages:
2:10:45 PM:     gatsby: 2.23.22 => 2.23.22
2:10:45 PM:     gatsby-image: ^2.4.12 => 2.4.12
2:10:45 PM:     gatsby-plugin-advanced-sitemap: ^1.5.5 => 1.5.5
2:10:45 PM:     gatsby-plugin-google-analytics: ^2.3.10 => 2.3.10
2:10:45 PM:     gatsby-plugin-manifest: ^2.4.17 => 2.4.17
2:10:45 PM:     gatsby-plugin-netlify: ^2.3.10 => 2.3.10
2:10:45 PM:     gatsby-plugin-netlify-cache: ^1.2.0 => 1.2.0
2:10:45 PM:     gatsby-plugin-offline: ^3.2.16 => 3.2.16
2:10:45 PM:     gatsby-plugin-react-helmet: ^3.3.9 => 3.3.9
2:10:45 PM:     gatsby-plugin-sass: ^2.3.10 => 2.3.10
2:10:45 PM:     gatsby-plugin-sharp: ^2.6.18 => 2.6.18
2:10:45 PM:     gatsby-plugin-typescript: ^2.4.13 => 2.4.13
2:10:45 PM:     gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4
2:10:45 PM:     gatsby-source-filesystem: ^2.3.18 => 2.3.18
2:10:45 PM:     gatsby-source-prismic-graphql: 3.6.2 => 3.6.2
2:10:45 PM:     gatsby-transformer-sharp: ^2.5.10 => 2.5.10
2:10:47 PM: info Deleting .cache, public
2:10:47 PM: info Successfully deleted directories
2:10:50 PM: success open and validate gatsby-configs - 0.050s
2:10:52 PM: success load plugins - 1.284s
2:10:52 PM: success onPreInit - 0.017s
2:10:52 PM: success delete html and css files from previous builds - 0.014s
2:10:52 PM: success initialize cache - 0.009s
2:10:52 PM: success copy gatsby files - 0.032s
2:10:52 PM: success onPreBootstrap - 0.010s
2:10:52 PM: success createSchemaCustomization - 0.008s
2:10:53 PM: success source and transform nodes - 1.001s
2:10:53 PM: success building schema - 0.371s
2:10:54 PM: success Downloading remote files - 0.289s - 4/4 13.83/s
2:10:54 PM: success createPages - 0.966s
2:10:54 PM: success createPagesStatefully - 0.231s
2:10:55 PM: success updating schema - 0.195s
2:10:55 PM: success onPreExtractQueries - 0.012s
2:10:55 PM: success extract queries from components - 0.930s
2:10:55 PM: success write out redirect data - 0.018s
2:10:56 PM: success Build manifest and related icons - 0.439s
2:10:56 PM: success onPostBootstrap - 0.440s
2:10:56 PM: info bootstrap finished - 8.800s
2:10:57 PM: success Downloading remote files - 0.470s - 5/5 10.65/s
2:10:57 PM: success run static queries - 0.789s - 6/6 7.61/s
2:10:57 PM: success run page queries - 0.015s - 11/11 741.00/s
2:10:57 PM: success write out requires - 0.040s
2:11:59 PM: warning chunk styles [mini-css-extract-plugin]
2:11:59 PM: Conflicting order. Following module has been added:
2:11:59 PM:  * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/src??postcss-3!./node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./src/components/footer.scss
2:11:59 PM: despite it was not able to fulfill desired ordering with these modules:
2:11:59 PM:  * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/src??postcss-3!./node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./src/components/reserveTable.scss
2:11:59 PM:    - couldn't fulfill desired order of chunk group(s) component---src-pages-index-tsx   - while fulfilling desired order of chunk group(s) component---src-pages-cookie-policy-tsx, component---src-pages-events-tsx, component---src-pages-menus-tsx, component---src-templates-menu-tsx, component---src-templates-notice-tsx
2:11:59 PM: failed Building production JavaScript and CSS bundles - 61.853s
2:11:59 PM: error Generating JavaScript bundles failed
2:11:59 PM: Can't resolve '../../public/static/d/1616807290.json' in '/opt/build/repo/src/pages'
2:11:59 PM: If you're trying to use a package make sure that '../../public/static/d/1616807290.json' is installed. If you're trying to use a local file make sure that the path is correct.
2:11:59 PM: error Generating JavaScript bundles failed
2:11:59 PM: Can't resolve '../../public/static/d/2693142731.json' in '/opt/build/repo/src/pages'
2:11:59 PM: If you're trying to use a package make sure that '../../public/static/d/2693142731.json' is installed. If you're trying to use a local file make sure that the path is correct.
2:11:59 PM: error Generating JavaScript bundles failed
2:11:59 PM: Can't resolve '../../public/static/d/2783073965.json' in '/opt/build/repo/src/utils'
2:11:59 PM: If you're trying to use a package make sure that '../../public/static/d/2783073965.json' is installed. If you're trying to use a local file make sure that the path is correct.
2:11:59 PM: error Generating JavaScript bundles failed
2:11:59 PM: Can't resolve '../../public/static/d/2861473417.json' in '/opt/build/repo/src/pages'
2:11:59 PM: If you're trying to use a package make sure that '../../public/static/d/2861473417.json' is installed. If you're trying to use a local file make sure that the path is correct.
2:11:59 PM: error Generating JavaScript bundles failed
2:11:59 PM: Can't resolve '../../public/static/d/66993800.json' in '/opt/build/repo/src/pages'
2:11:59 PM: If you're trying to use a package make sure that '../../public/static/d/66993800.json' is installed. If you're trying to use a local file make sure that the path is correct.
2:11:59 PM: not finished Generating image thumbnails - 65.121s
2:11:59 PM: npm ERR! code ELIFECYCLE
2:11:59 PM: npm ERR! errno 1
2:11:59 PM: npm ERR! ***@0.1.0 build: `gatsby info --clipboard && gatsby clean && gatsby build`
2:11:59 PM: npm ERR! Exit status 1
2:11:59 PM: npm ERR!
2:11:59 PM: npm ERR! Failed at the the-***@0.1.0 build script.
2:11:59 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2:11:59 PM: npm ERR! A complete log of this run can be found in:
2:11:59 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-07-08T13_11_59_305Z-debug.log
2:11:59 PM: โ€‹
2:11:59 PM: โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
2:11:59 PM: โ”‚   "build.command" failed    โ”‚
2:11:59 PM: โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
2:11:59 PM: โ€‹
2:11:59 PM:   Error message
2:11:59 PM:   Command failed with exit code 1: npm run build
2:11:59 PM: โ€‹
2:11:59 PM:   Error location
2:11:59 PM:   In Build command from Netlify app:
2:11:59 PM:   npm run build
2:11:59 PM: โ€‹
2:11:59 PM:   Resolved config
2:11:59 PM:   build:
2:11:59 PM:     command: npm run build
2:11:59 PM:     commandOrigin: ui
2:11:59 PM:     publish: /opt/build/repo/public
2:11:59 PM: Caching artifacts
2:11:59 PM: Started saving node modules
2:11:59 PM: Finished saving node modules
2:11:59 PM: Started saving build plugins
2:11:59 PM: Finished saving build plugins
2:11:59 PM: Started saving pip cache
2:11:59 PM: Finished saving pip cache
2:11:59 PM: Started saving emacs cask dependencies
2:11:59 PM: Finished saving emacs cask dependencies
2:11:59 PM: Started saving maven dependencies
2:11:59 PM: Finished saving maven dependencies
2:11:59 PM: Started saving boot dependencies
2:11:59 PM: Finished saving boot dependencies
2:11:59 PM: Started saving go dependencies
2:12:01 PM: Finished saving go dependencies
2:12:05 PM: Error running command: Build script returned non-zero exit code: 1
2:12:05 PM: Failing build: Failed to build site
2:12:05 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
2:12:05 PM: Finished processing build request in 2m51.80466115s

Environment

Local

System:
    OS: Windows 10 10.0.19041
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Binaries:
    Node: 12.18.2 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.7.7
  Browsers:
    Edge: 44.19041.1.0
  npmPackages:
    gatsby: 2.23.22 => 2.23.22
    gatsby-image: ^2.4.12 => 2.4.12
    gatsby-plugin-advanced-sitemap: ^1.5.5 => 1.5.5
    gatsby-plugin-google-analytics: ^2.3.10 => 2.3.10
    gatsby-plugin-manifest: ^2.4.17 => 2.4.17
    gatsby-plugin-netlify: ^2.3.10 => 2.3.10
    gatsby-plugin-netlify-cache: ^1.2.0 => 1.2.0
    gatsby-plugin-offline: ^3.2.16 => 3.2.16
    gatsby-plugin-react-helmet: ^3.3.9 => 3.3.9
    gatsby-plugin-sass: ^2.3.10 => 2.3.10
    gatsby-plugin-sharp: ^2.6.18 => 2.6.18
    gatsby-plugin-typescript: ^2.4.13 => 2.4.13
    gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4
    gatsby-source-filesystem: ^2.3.18 => 2.3.18
    gatsby-source-prismic-graphql: 3.6.2 => 3.6.2
    gatsby-transformer-sharp: ^2.5.10 => 2.5.10

Netlfy

System:
     OS: Linux 4.14 Ubuntu 16.04.6 LTS (Xenial Xerus)
     CPU: (8) x64 Intel(R) Xeon(R) CPU @ 2.30GHz
     Shell: 4.3.48 - /bin/bash
   Binaries:
     Node: 12.18.2 - ~/.nvm/versions/node/v12.18.2/bin/node
     npm: 6.14.5 - ~/.nvm/versions/node/v12.18.2/bin/npm
   Languages:
     Python: 2.7.12 - /opt/buildhome/python2.7/bin/python
   npmPackages:
     gatsby: 2.23.22 => 2.23.22
     gatsby-image: ^2.4.12 => 2.4.12
     gatsby-plugin-advanced-sitemap: ^1.5.5 => 1.5.5
     gatsby-plugin-google-analytics: ^2.3.10 => 2.3.10
     gatsby-plugin-manifest: ^2.4.17 => 2.4.17
     gatsby-plugin-netlify: ^2.3.10 => 2.3.10
     gatsby-plugin-netlify-cache: ^1.2.0 => 1.2.0
     gatsby-plugin-offline: ^3.2.16 => 3.2.16
     gatsby-plugin-react-helmet: ^3.3.9 => 3.3.9
     gatsby-plugin-sass: ^2.3.10 => 2.3.10
     gatsby-plugin-sharp: ^2.6.18 => 2.6.18
     gatsby-plugin-typescript: ^2.4.13 => 2.4.13
     gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4
     gatsby-source-filesystem: ^2.3.18 => 2.3.18
     gatsby-source-prismic-graphql: 3.6.2 => 3.6.2
     gatsby-transformer-sharp: ^2.5.10 => 2.5.10
needs reproduction StaticQuery bug

Most helpful comment

It seems like my issue was related to https://github.com/gatsbyjs/gatsby/issues/24673 where I was defining gatsby-plugin-typescript

All 8 comments

I'm seeing this too

System: OS: macOS 10.14.6 CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz Shell: 3.2.57 - /bin/bash Binaries: Node: 10.16.0 - /usr/local/bin/node Yarn: 1.17.3 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Languages: Python: 2.7.10 - /usr/bin/python Browsers: Chrome: 83.0.4103.116 Firefox: 70.0.1 Safari: 12.1.2 npmPackages: gatsby: ^2.23.22 => 2.23.22 gatsby-image: ^2.4.12 => 2.4.12 gatsby-plugin-alias-imports: ^1.0.5 => 1.0.5 gatsby-plugin-env-variables: ^1.0.2 => 1.0.2 gatsby-plugin-google-analytics: ^2.3.10 => 2.3.10 gatsby-plugin-google-fonts: 1.0.1 => 1.0.1 gatsby-plugin-hotjar: ^1.0.1 => 1.0.1 gatsby-plugin-mailchimp: ^5.2.2 => 5.2.2 gatsby-plugin-manifest: ^2.4.17 => 2.4.17 gatsby-plugin-netlify-functions: 0.0.3 => 0.0.3 gatsby-plugin-offline: ^3.2.16 => 3.2.16 gatsby-plugin-react-helmet: ^3.3.9 => 3.3.9 gatsby-plugin-react-svg: ^3.0.0 => 3.0.0 gatsby-plugin-robots-txt: ^1.5.1 => 1.5.1 gatsby-plugin-sass: ^2.3.10 => 2.3.10 gatsby-plugin-sharp: ^2.6.18 => 2.6.18 gatsby-plugin-shopify-buy: 0.0.2 => 0.0.2 gatsby-plugin-sitemap: ^2.4.10 => 2.4.10 gatsby-source-filesystem: ^2.3.18 => 2.3.18 gatsby-source-prismic-graphql: github:prismicio/gatsby-source-prismic-graphql#flat => 3.6.2 gatsby-source-shopify2: ^2.0.7 => 2.0.7 gatsby-transformer-sharp: ^2.5.10 => 2.5.10 npmGlobalPackages: gatsby-cli: 2.7.44

Is either of you able to share your site so we could drill into the issue?

Interesting the names for the static json files are different to what's generated locally, but I'm not sure if this is expected.

This should be stable, as this is "hash" generated from your static query text input. It might be related to fact that your local env is on Windows and Netlify is on linux, which could result in subtly different line endings (LF vs CRLF) depending on some git settings - but this is just shot in the dark and even if the hashes are different, it should still build on Netlify

It seems like my issue was related to https://github.com/gatsbyjs/gatsby/issues/24673 where I was defining gatsby-plugin-typescript

@BottlecapDave I appear to be experiencing the same issue:

9:03:07 AM: failed Building production JavaScript and CSS bundles - 145.045s
9:03:07 AM: error Generating JavaScript bundles failed
9:03:07 AM: Can't resolve '../context/ContextProvider' in '/opt/build/repo/src/components'
9:03:07 AM: If you're trying to use a package make sure that '../context/ContextProvider' is installed. If you're trying to use a local file make sure that the path is correct.

Did you correct the issue? You mention _where I was defining gatsby-plugin-typescript_. Could you provide details regarding your fix?

My issue seemed to be around my upgrade process where I had gatsby-plugin-typescript defined in my package.json and also in my Gatsby config. According to the comment I linked, this was no longer needed and seemed to be causing issues, so I removed it from package.json and gatsby config.

I assume an older explicit version was being used instead of a newer internal one. Why this only occured on Linux I don't know.

It looks like you might be having a different issue, which might be caused by the casing of your contextprovider file (eg contextProvider Vs ContextProvider) which has tripped me up on different os (Linux cares about casing, windows doesn't)

@chrisworman-pela Could you confirm that this was related to case sensitivity as @BottlecapDave described?

@freiksenet Yes, I can confirm that my issue was caused by case sensitivity in CI but not local.

It sounds like this issue is fixed, yes? I'm closing this, but if it's not fixed then please either re-open, or open a new issue.

Was this page helpful?
0 / 5 - 0 ratings