Gatsby: [v2] Build breaking on Netlify

Created on 16 Sep 2018  ·  5Comments  ·  Source: gatsbyjs/gatsby

Description

Build works locally, but fails on Netlify.

Steps to reproduce

Project is here: https://github.com/merelinguist/playhouse-press/pull/225

Expected result

I would expect it to build normally.

Actual result

Build works fine locally, but breaks on Netlify:

error Generating JavaScript bundles failed

  Error: ./src/components/Page/index.js
  Module not found: Error: Can't resolve '../Footer' in '/opt/build/repo/src/com  ponents/Page'
  resolve '../Footer' in '/opt/build/repo/src/components/Page'
    using description file: /opt/build/repo/package.json (relative path: ./src/c  omponents/Page)
      Field 'browser' doesn't contain a valid alias configuration
      using description file: /opt/build/repo/package.json (relative path: ./src  /components/Footer)
        no extension
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/Footer doesn't exist
        .js
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/Footer.js doesn't exist
        .jsx
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/Footer.jsx doesn't exist
        as directory
          /opt/build/repo/src/components/Footer doesn't exist
  [/opt/build/repo/src/components/Footer]
  [/opt/build/repo/src/components/Footer.js]
  [/opt/build/repo/src/components/Footer.jsx]
   @ ./src/components/Page/index.js 8:0-31 69:29-35
   @ ./src/templates/post.js
   @ ./.cache/async-requires.js
   @ ./.cache/production-app.js


  Error: ./src/templates/post.js
  Module not found: Error: Can't resolve '../components/PostView' in '/opt/build  /repo/src/templates'
  resolve '../components/PostView' in '/opt/build/repo/src/templates'
    using description file: /opt/build/repo/package.json (relative path: ./src/t  emplates)
      Field 'browser' doesn't contain a valid alias configuration
      using description file: /opt/build/repo/package.json (relative path: ./src  /components/PostView)
        no extension
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/PostView doesn't exist
        .js
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/PostView.js doesn't exist
        .jsx
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/PostView.jsx doesn't exist
        as directory
          /opt/build/repo/src/components/PostView doesn't exist
  [/opt/build/repo/src/components/PostView]
  [/opt/build/repo/src/components/PostView.js]
  [/opt/build/repo/src/components/PostView.jsx]
   @ ./src/templates/post.js 5:0-46 16:26-34
   @ ./.cache/async-requires.js
   @ ./.cache/production-app.js

Environment

  System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.10.0 - ~/.nvm/versions/node/v10.10.0/bin/node
    Yarn: 1.9.4 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.10.0/bin/npm
  Browsers:
    Safari: 11.1.2
  npmPackages:
    gatsby: ^2.0.0-rc.25 => 2.0.0-rc.25 
    gatsby-plugin-react-helmet: ^3.0.0-rc.1 => 3.0.0-rc.1 
    gatsby-plugin-styled-components: ^3.0.0-rc.5 => 3.0.0-rc.5 
    gatsby-source-filesystem: ^2.0.1-rc.6 => 2.0.1-rc.6 
    gatsby-transformer-remark: ^2.1.1-rc.5 => 2.1.1-rc.5 

Most helpful comment

I was also riding in circles around this same issue.

This solved it for me:

git config core.ignorecase false

I've never had issue with case-senstive file name changes.
Either it was just a coincidence or this is part of the Gatsby v2 Starter??

All 5 comments

This is because you have a case difference in what you're requiring and the name of the file. This works in Macs and doesn't for Linux.

I was also riding in circles around this same issue.

This solved it for me:

git config core.ignorecase false

I've never had issue with case-senstive file name changes.
Either it was just a coincidence or this is part of the Gatsby v2 Starter??

how to resolve this while pushing to a docker container ?

I had the same problem, I fixed by manually changing the imports.

Before:
import Features from "../components/features/features";
After:
import Features from "../components/features/Features";

Credits to talves on StackOverFlow

Just ran into the same mistake. Shouldn't this be something that produces an error in development?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timbrandin picture timbrandin  ·  3Comments

brandonmp picture brandonmp  ·  3Comments

magicly picture magicly  ·  3Comments

ghost picture ghost  ·  3Comments

KyleAMathews picture KyleAMathews  ·  3Comments