Build fails - can't find module

I’m having builds fail on Netlify after importing from react-simple-maps. Note that ‘react-simple-maps’ is in my package.json file, and builds work fine locally but not remotely. Builds also fail redploying with a cleared cache.

Going back through my commits one-by-one (luckily it didn’t take long to find the breaking change), I found the three relevant commits and have detailed them below.

  • commit 72866e

    • most recent working build pre install - locally and remotely
  • commit 5f4314

    • installed ‘react-simple-maps’ via npm i react-simple-maps
    • working build - locally and remotely
  • commit a9c9ec

    • added import { ... } from react-simple maps statements to top of component using that module
    • this was the breaking change
    • build works locally, but fails on Netlify

The logs from the last build attempt are as follows.

1:02:03 PM: Build ready to start
1:02:05 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
1:02:05 PM: build-image tag: v3.3.2
1:02:05 PM: buildbot version: 16db6527b4cafa2553c3f3f11aa8d1b46a72ff40
1:02:06 PM: Fetching cached dependencies
1:02:06 PM: Starting to download cache of 283.7MB
1:02:08 PM: Finished downloading cache in 2.978726164s
1:02:08 PM: Starting to extract cache
1:02:22 PM: Finished extracting cache in 13.640389862s
1:02:22 PM: Finished fetching cache in 16.763341377s
1:02:22 PM: Starting to prepare the repo for build
1:02:23 PM: Preparing Git Reference refs/heads/dev
1:02:25 PM: Starting build script
1:02:25 PM: Installing dependencies
1:02:26 PM: Started restoring cached node version
1:02:30 PM: Finished restoring cached node version
1:02:31 PM: v10.16.3 is already installed.
1:02:33 PM: Now using node v10.16.3 (npm v6.9.0)
1:02:33 PM: Attempting ruby version 2.6.2, read from environment
1:02:34 PM: Using ruby version 2.6.2
1:02:35 PM: Using PHP version 5.6
1:02:35 PM: Started restoring cached node modules
1:02:35 PM: Finished restoring cached node modules
1:02:35 PM: Installing NPM modules using NPM version 6.9.0
1:03:04 PM: npm
1:03:04 PM:  WARN Invalid name: "FABRIC Testbed"
1:03:04 PM: npm WARN ts-pnp@1.1.2 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
1:03:04 PM: npm WARN repo No description
1:03:04 PM: npm WARN repo No repository field.
1:03:04 PM: npm WARN repo No README data
1:03:04 PM: npm WARN repo No license field.
1:03:04 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
1:03:04 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
1:03:04 PM: audited 97103 packages in 27.716s
1:03:04 PM: found 0 vulnerabilities
1:03:04 PM: NPM modules installed
1:03:04 PM: Started restoring cached go cache
1:03:04 PM: Finished restoring cached go cache
1:03:04 PM: unset GOOS;
1:03:04 PM: unset GOARCH;
1:03:04 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
1:03:04 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
1:03:04 PM: go version >&2;
1:03:04 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
1:03:04 PM: go version go1.12 linux/amd64
1:03:04 PM: Installing missing commands
1:03:04 PM: Verify run directory
1:03:04 PM: Executing user command: gatsby build
1:03:07 PM: success open and validate gatsby-configs — 0.143
1:03:09 PM: success load plugins — 1.406
1:03:09 PM: success onPreInit — 0.014
1:03:09 PM: success delete html and css files from previous builds — 0.020
1:03:09 PM: success initialize cache — 0.026
1:03:09 PM: success copy gatsby files — 0.053
1:03:09 PM: success onPreBootstrap — 0.027
1:03:09 PM: success source and transform nodes — 0.425
1:03:10 PM: success building schema — 0.555
1:03:10 PM: success createPages — 0.147
1:03:10 PM: success createPagesStatefully — 0.068
1:03:10 PM: success onPreExtractQueries — 0.015
1:03:10 PM: success update schema — 0.096
1:03:11 PM: success extract queries from components — 0.746
1:03:11 PM: success write out requires — 0.019
1:03:11 PM: success write out redirect data — 0.014
1:03:11 PM: success Build manifest and related icons — 0.323
1:03:11 PM: success onPostBootstrap — 0.342
1:03:11 PM: info bootstrap finished - 7.023 s
1:03:15 PM: success run static queries — 3.568 — 4/4 1.13 queries/second
1:03:30 PM: error #98123 WEBPACK
1:03:30 PM: Generating JavaScript bundles failed
1:03:30 PM: Can't resolve 'react-simple-maps' in '/opt/build/repo/src/components/Modules'
1:03:30 PM: File: src/components/Modules/Map.js
1:03:30 PM: See our docs page for more info on this error: https://gatsby.dev/issue-how-to
1:03:30 PM: Skipping functions preparation step: no functions directory set
1:03:30 PM: Caching artifacts
1:03:30 PM: Started saving node modules
1:03:30 PM: Finished saving node modules
1:03:30 PM: Started saving pip cache
1:03:30 PM: Finished saving pip cache
1:03:30 PM: Started saving emacs cask dependencies
1:03:30 PM: Finished saving emacs cask dependencies
1:03:30 PM: Started saving maven dependencies
1:03:30 PM: Finished saving maven dependencies
1:03:30 PM: Started saving boot dependencies
1:03:30 PM: Finished saving boot dependencies
1:03:30 PM: Started saving go dependencies
1:03:30 PM: Finished saving go dependencies
1:03:30 PM: Error running command: Build script returned non-zero exit code: 1
1:03:30 PM: Failing build: Failed to build site
1:03:30 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
1:03:30 PM: Finished processing build request in 1m25.167350587s

The issue lies on these lines:

...
1:03:30 PM: error #98123 WEBPACK
1:03:30 PM: Generating JavaScript bundles failed
1:03:30 PM: Can't resolve 'react-simple-maps' in '/opt/build/repo/src/components/Modules'
...

Any help remedying this would be very appreciated! Thanks!

Hi @mbwatson, is the repo public? If so, can you share a link to it? Also note that our build environment is case sensitive (Ubuntu), and you’re using uppercase letters in your directory and file names, while this would not cause failures locally, it can cause failures on a different OS.

Thanks for your response! I’m currently working through this issue via email through a support request, too. I’ve tried renaming every file in the application to lowercase to no avail. I’m pulling the docker image now to run a containerized build to further diagnose. I’m sure it’s something simple.

I develop in Ubuntu, so it’s good to know that piece of the puzzle is the same in both places.

I’ll update this thread further as I learn more. Thanks!

Edit: I forgot – yes, the repo is public: GitHub - mbwatson/fabric

Hi @mbwatson, we’ll help you in your support issue then. Feel free to update this thread if it remains unresolved there. :slightly_smiling_face:

Thanks for your help resolving this issue. Changing the build command from gatsby build to npm run build seemed to fix the build failures.

1 Like