Gatsby: Cannot find gatsby-config.js

Created on 9 Jul 2019  路  9Comments  路  Source: gatsbyjs/gatsby

Description

After upgrading from [email protected] to [email protected], running npm start throws the following error:

 ERROR #10123  CONFIG

We encountered an error while trying to load your site's gatsby-config. Please fix the error and try again.

  Error: C:\Users\Shreyans\Documents\pdftron-dev-site\node_modules\gatsby\dist\bootstrap\get-config-file.js:1

  Error: Cannot find module 'C:\\Users\\Shreyans\\Documents\\pdftron-dev-site\\node_modules\\gatsby-plugin-layout\\gatsby-config'

I have only been able to reproduce this issue on windows. I can confirm that these files do not exist (on both windows & mac), but mac seems to handle it gracefully.

I tried adding a fake gatsby-config.js to C:\\Users\\Shreyans\\Documents\\pdftron-dev-site\\node_modules\\gatsby-plugin-layout\\gatsby-config, and the error went away, but then the same error was thrown for a different plugin.

Expected result

Missing config files should be handled gracefully.

Actual result

They are not.

Environment

System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Binaries:
npm: 6.10.0 - C:Program Filesnodejsnpm.CMD
Languages:
Python: 2.7.16 - /c/Python27/python
Browsers:
Edge: 44.18362.1.0
npmPackages:
gatsby: 2.13.9 => 2.13.9
gatsby-link: ^2.0.4 => 2.2.0
gatsby-plugin-catch-links: 2.0.3 => 2.0.3
gatsby-plugin-google-analytics: 2.0.0-rc.2 => 2.0.0-rc.2
gatsby-plugin-layout: 1.1.0 => 1.1.0
gatsby-plugin-react-helmet: 3.0.0-rc.1 => 3.0.0-rc.1
gatsby-plugin-sass: 2.0.0-rc.2 => 2.0.0-rc.2
gatsby-remark-autolink-headers: 2.0.0-rc.2 => 2.0.0-rc.2
gatsby-remark-copy-linked-files: 2.0.0-rc.5 => 2.0.0-rc.5
gatsby-remark-external-links: 0.0.4 => 0.0.4
gatsby-source-filesystem: 2.0.1-rc.6 => 2.0.1-rc.6
gatsby-transformer-json: 2.1.1-rc.6 => 2.1.1-rc.6
gatsby-transformer-remark: 2.1.4 => 2.1.4

question or discussion

Most helpful comment

Trying to create a repo where I can reproduce the issue and cannot, so Im assuming it's probably repo dependant. Ill try @ipatate suggestion and close this ticket for now until I can find out some more info. Thanks for the help guys!

All 9 comments

Try reinstall all packages, remove node_modules and package-lock.json or yarn.lock

Hi @dantehemerson, we tried this on multiple machines with no luck :(

try gatsby clean ? or upgrade to 2.13.11 or more.

I'd recommend updating your dependencies. Looks like most of these plugins are release candidates from the early days of Gatsby v2. I bet there are some compatibility issues.

Thanks for the suggestions guys. We have updated all our dependencies to the following versions:

    gatsby: ^2.13.10 => 2.13.10
    gatsby-link: ^2.0.4 => 2.2.0
    gatsby-plugin-catch-links: 2.0.3 => 2.0.3
    gatsby-plugin-google-analytics: ^2.1.1 => 2.1.1
    gatsby-plugin-layout: ^1.1.0 => 1.1.0
    gatsby-plugin-react-helmet: ^3.1.0 => 3.1.0
    gatsby-plugin-sass: ^2.1.0 => 2.1.0
    gatsby-remark-autolink-headers: ^2.1.0 => 2.1.0
    gatsby-remark-copy-linked-files: ^2.1.0 => 2.1.0
    gatsby-remark-external-links: ^0.0.4 => 0.0.4
    gatsby-source-filesystem: ^2.1.2 => 2.1.2
    gatsby-transformer-json: ^2.2.0 => 2.2.0
    gatsby-transformer-remark: ^2.6.1 => 2.6.1

and still no luck.

Could you share a repo to reproduce the error?

this is what I will do :

  • create new project gatsby empty
  • add all plugin manually
  • copy gastby file ( gatsby config, gatsby-node...) from the broken project
  • copy src from the broken project
    and test.

Trying to create a repo where I can reproduce the issue and cannot, so Im assuming it's probably repo dependant. Ill try @ipatate suggestion and close this ticket for now until I can find out some more info. Thanks for the help guys!

I know this was a year ago, but did anyone find the solution to this? Having the same error here: https://github.com/wesbos/master-gatsby/issues/28

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andykais picture andykais  路  3Comments

3CordGuy picture 3CordGuy  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

kalinchernev picture kalinchernev  路  3Comments