Gatsby: [v2] Gatsby Build and Develop throws error

Created on 17 Aug 2018  路  5Comments  路  Source: gatsbyjs/gatsby

Summary

After upgrading to Beta 110, I see this error in develop as well as build.

Relevant information

Console Log in Gatsby develop

info bootstrap finished - 368.638 s

here ./.cache/develop-static-entry.js
Module build failed (from ./node_modules/gatsby/dist/utils/babel-loader.js):
ReferenceError: Unknown option: .cacheDirectory. Check out http://babeljs.io/docs/usage/options/ for more information about options.
    at buildUnknownError (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\@babel\core\lib\config\validation\options.js:113:11)
    at Object.keys.forEach.key (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\@babel\core\lib\config\validation\options.js:99:57)
    at Array.forEach (<anonymous>)
    at validate (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\@babel\core\lib\config\validation\options.js:69:21)
    at file (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\@babel\core\lib\config\config-chain.js:158:34)
    at cachedFunction (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\@babel\core\lib\config\caching.js:32:19)
    at buildRootChain (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\@babel\core\lib\config\config-chain.js:114:36)
    at loadPrivatePartialConfig (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\@babel\core\lib\config\partial.js:55:55)
    at Object.loadPartialConfig (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\@babel\core\lib\config\partial.js:80:18)
    at Object.<anonymous> (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\babel-loader\lib\index.js:82:26)
    at Generator.next (<anonymous>)
    at step (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\babel-loader\lib\index.js:3:221)
    at _next (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\babel-loader\lib\index.js:3:409)
    at tryCatch (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\es6-promise\dist\es6-promise.js:409:12)
    at invokeCallback (D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\es6-promise\dist\es6-promise.js:424:13)
    at D:\Workspace\Gatsby V2 Migration Workspace\Backup\MT\node_modules\es6-promise\dist\es6-promise.js:176:14
error There was an error compiling the html.js component for the development server.

See our docs page on debugging HTML builds for help https://goo.gl/yL9lND


  WebpackError: ./.cache/develop-static-entry.js




  - bootstrap:58 validate
    lib/webpack/bootstrap:58:1


  - bootstrap:21 cachedFunction
    lib/webpack/bootstrap:21:1


  - bootstrap:44 loadPrivatePartialConfig
    lib/webpack/bootstrap:44:1

  - bootstrap:69 Object.loadPartialConfig
    lib/webpack/bootstrap:69:1

  - bootstrap:71 Object.<anonymous>
    lib/webpack/bootstrap:71:1


  - universalModuleDefinition:3 step
    lib/webpack/universalModuleDefinition:3:1

  - universalModuleDefinition:3 _next
    lib/webpack/universalModuleDefinition:3:1




Environment (if relevant)

System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Binaries:
Yarn: 1.7.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 41.16299.248.0
npmPackages:
gatsby: ^2.0.0-beta.110 => 2.0.0-beta.110
gatsby-image: 2.0.0-beta.8 => 2.0.0-beta.8
gatsby-link: ^2.0.0-beta.22 => 2.0.0-beta.22
gatsby-plugin-canonical-urls: ^1.0.18 => 1.0.18
gatsby-plugin-google-analytics: ^2.0.0-beta.4 => 2.0.0-beta.4
gatsby-plugin-google-tagmanager: ^1.0.19 => 1.0.19
gatsby-plugin-i18n: ^0.4.2 => 0.4.2
gatsby-plugin-manifest: ^2.0.2-beta.6 => 2.0.2-beta.6
gatsby-plugin-offline: ^2.0.0-beta.9 => 2.0.0-beta.9
gatsby-plugin-purify-css: ^2.2.1 => 2.2.1
gatsby-plugin-react-helmet: ^3.0.0-beta.4 => 3.0.0-beta.4
gatsby-plugin-robots-txt: ^1.3.0 => 1.3.0
gatsby-plugin-sharp: ^2.0.0-beta.9 => 2.0.0-beta.9
gatsby-plugin-sitemap: ^2.0.0-beta.4 => 2.0.0-beta.4
gatsby-source-contentful: ^2.0.1-beta.18 => 2.0.1-beta.18
gatsby-transformer-remark: ^2.1.1-beta.6 => 2.1.1-beta.6
gatsby-transformer-sharp: ^2.1.1-beta.7 => 2.1.1-beta.7

File contents (if changed)

.babelrc

{
    "cacheDirectory" : true,
    "babelrc" : false,
    "presets" : [
      [
        "@babel/preset-env",
        {
          "loose": true,
          "modules": false,
          "useBuiltIns": "usage",
          "shippedProposals": true,
          "targets": {
            "browsers": [">0.25%", "not dead"]
          }
        }
      ],
      [
        "@babel/preset-react",
        {
          "useBuiltIns": true,
          "pragma": "React.createElement"
        }
      ],
      "@babel/preset-flow"
    ],
    "plugins": [
        "babel-plugin-transform-decorators-legacy",
      [
        "@babel/plugin-proposal-class-properties",
        {
          "loose": true
        }
      ],
      "@babel/plugin-syntax-dynamic-import",
      [
        "@babel/plugin-transform-runtime",
        {
          "helpers": true,
          "regenerator": true,
          "polyfill": false
        }
      ]
    ]
  }

Most helpful comment

I had the same problem and fixed putting this on babel configuration:

"babel": {
    "presets": [
      "babel-preset-gatsby"
    ],
   ...
}

All 5 comments

Hey, we recently did some change related to babel - can you check https://next.gatsbyjs.org/docs/babel/ for newest minimal setup?

Yeah, you just need to remove the first two lines from your .babelrc file.

"cacheDirectory" : true,
"babelrc" : false,

I had the same problem and fixed putting this on babel configuration:

"babel": {
    "presets": [
      "babel-preset-gatsby"
    ],
   ...
}

i just ran into a similar issue.

```WebpackError: ./.cache/develop-static-entry.js

I don't have a .babelrc file but tried adding one and doing what timotta said worked for him but unfortunately it didn't help me.

Still not working

Was this page helpful?
0 / 5 - 0 ratings