Sorry for the title, but i don't have any idea... Can not build my Gatsby app. When i'm using gatsby build, i got an error.
gatsby build π€·ββοΈ... I'm not sure, but if i comment the line of '@octokit/rest' import in my code, i can build correctly... I clear .cache && public folder, clear the node_modules, update my dependencies, and the issue is always here.
info bootstrap finished - 4.327 s
success Building production JavaScript and CSS bundles β 6.236 s
error Building static HTML for pages failed
See our docs page on debugging HTML builds for help https://goo.gl/yL9lND
77 |
78 | // __webpack_public_path__
> 79 | __webpack_require__.p = "/";
| ^
80 |
81 |
82 | // Load entry module and return exports
WebpackError: ./node_modules/node-fetch/lib/index.mjs 496:11-22
- bootstrap:79 HarmonyImportSpecifierDependency._getErrors
lib/webpack/bootstrap:79:1
- bootstrap:57 HarmonyImportSpecifierDependency.getErrors
lib/webpack/bootstrap:57:1
- assertThisInitialized.js:6 Compilation.finish
[lib]/[@babel]/runtime/helpers/assertThisInitialized.js:6:1
- parse-path.js:18 hooks.make.callAsync.err
lib/.cache/parse-path.js:18:3
- bootstrap:21 _err0
eval at create (lib/webpack/bootstrap:21:1
- gatsby-ssr.js:1 _addModuleChain
lib/gatsby-ssr.js:1:1
- api-runner-ssr.js:12 _combinedTickCallback
lib/.cache/api-runner-ssr.js:12:209
- api-runner-ssr.js:54 process._tickCallback
lib/.cache/api-runner-ssr.js:54:5
β gatsby info --clipboard
System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.9.2 - ~/.yarn/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
Browsers:
Firefox: 62.0
Safari: 12.0
npmPackages:
gatsby: ^2.0.9 => 2.0.9
gatsby-plugin-google-analytics: ^2.0.6 => 2.0.6
gatsby-plugin-manifest: ^2.0.4 => 2.0.4
gatsby-plugin-offline: ^2.0.5 => 2.0.5
gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
gatsby-plugin-sharp: ^2.0.5 => 2.0.5
gatsby-plugin-sitemap: ^2.0.1 => 2.0.1
gatsby-remark-copy-linked-files: ^2.0.5 => 2.0.5
gatsby-remark-images: ^2.0.3 => 2.0.3
gatsby-remark-prismjs: ^3.0.1 => 3.0.1
gatsby-remark-smartypants: ^2.0.5 => 2.0.5
gatsby-source-filesystem: ^2.0.1 => 2.0.1
gatsby-transformer-remark: ^2.1.4 => 2.1.4
npmGlobalPackages:
gatsby-cli: 2.4.1
If i delete the index.mjs to node_modules/node-fetch/lib/index.mjs, i can build nicely π€·ββοΈ
@AlexandreBourdeaudhui can you provide a reproduction repo for this? That would make it much simpler to diagnose this issue.
Hello @kakadiadarpan :wave:. Thanks for your response !
Of course i can => https://github.com/AlexandreBourdeaudhui/GatsbyReproduce
yarn start for gatsby develop run nicely, but yarn build for gatsby build fail with issue in my initial message.
The build is failing on this line:
Hello @helmutgranda π
If i'm switching config in src and change import for src/config or comment this line, my build is still breaking
Sorry @AlexandreBourdeaudhui, I meant to say that the build is failing from the repo you shared on that line because it is looking for that config file.
Oh ok ! But you can comment this line, it was an oversight.
I'm pushing a little commit for this.
Great, commenting the line works. After doing a little bit of research it is not an issue with Gatsby but rather it is a compatibility issue:
https://github.com/bitinn/node-fetch/issues/493#issuecomment-407985160
I submitted the code change that allows the build to run:
Here is the output:
success Building production JavaScript and CSS bundles β 3.784 s
success Building static HTML for pages β 1.128 s β 7/7 19.81 pages/second
Generated public/sw.js, which will precache 13 files, totaling 427729 bytes.
info Done building in 8.131 sec
Thank you sir @helmutgranda π ! That works fine now ! π± I'm going to update my main repo with your solution and i'm going to follow the thread to know when the compatibility issue will be solved.
Hello π
I reopen this issue, after update Gatsby's packages ; still have issues with the build and Webpack π...
~/Desktop/GatsbyReproduce on ξ master [!] is π¦ v1.0.0 via β¬’ v8.12.0 took 54s
β’100% β gatsby info --clipboard
System:
OS: macOS 10.14.1
CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.12.1 - ~/.yarn/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
Browsers:
Firefox: 63.0.1
Safari: 12.0.1
npmPackages:
gatsby: ^2.0.9 => 2.0.60
gatsby-plugin-google-analytics: ^2.0.6 => 2.0.8
gatsby-plugin-manifest: ^2.0.4 => 2.0.11
gatsby-plugin-offline: ^2.0.5 => 2.0.18
gatsby-plugin-react-helmet: ^3.0.0 => 3.0.4
gatsby-plugin-sharp: ^2.0.5 => 2.0.14
gatsby-plugin-sitemap: ^2.0.1 => 2.0.3
gatsby-remark-copy-linked-files: ^2.0.5 => 2.0.7
gatsby-remark-images: ^2.0.3 => 2.0.6
gatsby-remark-prismjs: ^3.0.1 => 3.1.2
gatsby-remark-smartypants: ^2.0.5 => 2.0.7
gatsby-source-filesystem: ^2.0.1 => 2.0.10
gatsby-transformer-remark: ^2.1.4 => 2.1.15
npmGlobalPackages:
gatsby-cli: 2.4.1
βββ
~/Desktop/GatsbyReproduce on ξ master [!] is π¦ v1.0.0 via β¬’ v8.12.0 took 43s
β’100% β yarn build
yarn run v1.12.1
$ gatsby build
success open and validate gatsby-configs β 0.072 s
success load plugins β 0.194 s
success onPreInit β 0.703 s
success delete html and css files from previous builds β 0.006 s
success initialize cache β 0.008 s
success copy gatsby files β 0.074 s
success onPreBootstrap β 0.009 s
success source and transform nodes β 0.097 s
success building schema β 0.464 s
success createPages β 0.044 s
success createPagesStatefully β 0.034 s
success onPreExtractQueries β 0.001 s
success update schema β 0.143 s
success extract queries from components β 0.051 s
success run graphql queries β 0.332 s β 7/7 21.20 queries/second
success write out page data β 0.005 s
success write out redirect data β 0.001 s
Generating image thumbnails [==============================] 6/6 0.1 secs 100%
info bootstrap finished - 4.725 s
success onPostBootstrap β 0.002 s
success Building production JavaScript and CSS bundles β 3.849 s
error Building static HTML for pages failed
See our docs page on debugging HTML builds for help https://goo.gl/yL9lND
67 | __webpack_require__.n = function(module) {
68 | var getter = module && module.__esModule ?
> 69 | function getDefault() { return module['default']; } :
| ^
70 | function getModuleExports() { return module; };
71 | __webpack_require__.d(getter, 'a', getter);
72 | return getter;
WebpackError: /Users/alexandrebourdeaudhui/Desktop/GatsbyReproduce/public/render-page.js:13519
- bootstrap:69 createScript
lib/webpack/bootstrap:69:1
- api-runner-ssr.js:19 Object.runInThisContext
lib/.cache/api-runner-ssr.js:19:1
- static-entry.js:27 Object.Module._extensions..js
lib/.cache/static-entry.js:27:1
- public-page-renderer.js:1 Module.load
lib/.cache/public-page-renderer.js:1:1
- gatsby-browser-entry.js:33 tryModuleLoad
lib/.cache/gatsby-browser-entry.js:33:9
- gatsby-browser-entry.js:22 Function.Module._load
lib/.cache/gatsby-browser-entry.js:22:9
- bootstrap:21 Promise
lib/webpack/bootstrap:21:1
- gatsby-browser-entry.js:1 Promise._resolveFromExecutor
lib/.cache/gatsby-browser-entry.js:1:1
- bootstrap:68 new Promise
lib/webpack/bootstrap:68:1
- bootstrap:5 tryCatcher
lib/webpack/bootstrap:5:1
- bootstrap:50 MappingPromiseArray._promiseFulfilled
lib/webpack/bootstrap:50:1
After search, i have this issue since [email protected] with the repo for reproduction. If i block the version in 2.0.50, i dont have any problem for build.
I see the changelog and see this commit : https://github.com/gatsbyjs/gatsby/commit/8061e3b, in particular https://github.com/gatsbyjs/gatsby/commit/8061e3b#diff-c4777e791f64fbb6c82255341b381dab.
I downloaded the version 2.0.50 in my project. Set the plugins in variable plugins.define(pluginX)]; and i log it
With the 2.0.50 ; i have this :
β { pluginX:
{ 'process.env':
{ NODE_ENV: '"production"',
PUBLIC_DIR: '"/Users/alexandrebourdeaudhui/Desktop/GatsbyReproduce/public"',
BUILD_STAGE: '"build-javascript"',
GATSBY_BUILD_STAGE: '"build-javascript"' },
__PATH_PREFIX__: '""' } }
success Building production JavaScript and CSS bundles β 3.988 s
β { pluginX:
{ 'process.env':
{ NODE_ENV: '"production"',
PUBLIC_DIR: '"/Users/alexandrebourdeaudhui/Desktop/GatsbyReproduce/public"',
BUILD_STAGE: '"build-html"',
GATSBY_BUILD_STAGE: '"build-html"' },
__PATH_PREFIX__: '""' } }
And all run as expected.
Btw, in the source code, apply the change of version 2.0.51... ; i got this :
β { pluginX:
{ 'process.env': '{}',
'process.env.NODE_ENV': '"production"',
'process.env.PUBLIC_DIR': '"/Users/alexandrebourdeaudhui/Desktop/GatsbyReproduce/public"',
'process.env.BUILD_STAGE': '"build-javascript"',
'process.env.GATSBY_BUILD_STAGE': '"build-javascript"',
__PATH_PREFIX__: '""' } }
success Building production JavaScript and CSS bundles β 3.481 s
β { pluginX:
{ 'process.env': '{}',
'process.env.NODE_ENV': '"production"',
'process.env.PUBLIC_DIR': '"/Users/alexandrebourdeaudhui/Desktop/GatsbyReproduce/public"',
'process.env.BUILD_STAGE': '"build-html"',
'process.env.GATSBY_BUILD_STAGE': '"build-html"',
__PATH_PREFIX__: '""' } }
And my build is failing π
Maybe something had change for the build and i dont see ? πΆ
Hiya!
This issue has gone quiet. Spooky quiet. π»
We get a lot of issues, so we currently close issues after 30 days of inactivity. Itβs been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
Thanks for being a part of the Gatsby community! πͺπ
Most helpful comment
Great, commenting the line works. After doing a little bit of research it is not an issue with Gatsby but rather it is a compatibility issue:
https://github.com/bitinn/node-fetch/issues/493#issuecomment-407985160
I submitted the code change that allows the build to run:
https://github.com/AlexandreBourdeaudhui/GatsbyReproduce/pull/1/commits/4fac04777290e67ad8f0da7c241ee6be6b21e861
Here is the output: