Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build doesn't work as expected #8583

Closed
AlexandreBourdeaudhui opened this issue Sep 27, 2018 · 12 comments
Closed

Build doesn't work as expected #8583

AlexandreBourdeaudhui opened this issue Sep 27, 2018 · 12 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. status: needs more info Needs triaging and reproducible examples or more information to be resolved status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting.

Comments

@AlexandreBourdeaudhui
Copy link

Description

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.

Steps to reproduce

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.

Actual result

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

Environment

➜ 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
@AlexandreBourdeaudhui
Copy link
Author

If i delete the index.mjs to node_modules/node-fetch/lib/index.mjs, i can build nicely 🤷‍♂️

@kakadiadarpan
Copy link
Contributor

@AlexandreBourdeaudhui can you provide a reproduction repo for this? That would make it much simpler to diagnose this issue.

@kakadiadarpan kakadiadarpan added status: needs more info Needs triaging and reproducible examples or more information to be resolved status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. labels Sep 27, 2018
@AlexandreBourdeaudhui
Copy link
Author

Hello @kakadiadarpan 👋. 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.

@helmutgranda
Copy link

@AlexandreBourdeaudhui
Copy link
Author

AlexandreBourdeaudhui commented Sep 27, 2018

Hello @helmutgranda 👋

If i'm switching config in src and change import for src/config or comment this line, my build is still breaking

@helmutgranda
Copy link

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.

@AlexandreBourdeaudhui
Copy link
Author

AlexandreBourdeaudhui commented Sep 27, 2018

Oh ok ! But you can comment this line, it was an oversight.
I'm pushing a little commit for this.

@helmutgranda
Copy link

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:

node-fetch/node-fetch#493 (comment)

I submitted the code change that allows the build to run:

https://github.com/AlexandreBourdeaudhui/GatsbyReproduce/pull/1/commits/4fac04777290e67ad8f0da7c241ee6be6b21e861

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

@AlexandreBourdeaudhui
Copy link
Author

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.

chikamichi added a commit to O-clock-Alumni/DeviensDev that referenced this issue Sep 29, 2018
- https://deviensdev-preprod.nico.oclock.io/
- déploiement sur PaaS Dokku (deviensdev-preprod)
- variables d'environnements :
  - DEVIENSDEV_GITHUB_TOKEN=...
  - ENV=production
  - NODE_ENV=production
- mapping de ports http:80:80 https:443:80
- Fix: "gatsby build" plante à cause de la gestion de .mjs par Wepback 4

@see gatsbyjs/gatsby#8583 (comment)
chikamichi added a commit to O-clock-Alumni/DeviensDev that referenced this issue Sep 29, 2018
- https://deviensdev-preprod.nico.oclock.io/
- déploiement sur PaaS Dokku (deviensdev-preprod)
- variables d'environnements :
  - DEVIENSDEV_GITHUB_TOKEN=...
  - ENV=production
  - NODE_ENV=production
- mapping de ports http:80:80 https:443:80
- Fix: "gatsby build" plante à cause de la gestion de .mjs par Wepback 4

@see gatsbyjs/gatsby#8583 (comment)
chikamichi added a commit to O-clock-Alumni/DeviensDev that referenced this issue Nov 16, 2018
- https://deviensdev-preprod.nico.oclock.io/
- déploiement sur PaaS Dokku (deviensdev-preprod)
- variables d'environnements :
  - DEVIENSDEV_GITHUB_TOKEN=...
  - ENV=production
  - NODE_ENV=production
- mapping de ports http:80:80 https:443:80
- Fix: "gatsby build" plante à cause de la gestion de .mjs par Wepback 4

@see gatsbyjs/gatsby#8583 (comment)
chikamichi added a commit to O-clock-Alumni/DeviensDev that referenced this issue Nov 16, 2018
- https://deviensdev-preprod.nico.oclock.io/
- déploiement sur PaaS Dokku (deviensdev-preprod)
- variables d'environnements :
  - DEVIENSDEV_GITHUB_TOKEN=...
  - ENV=production
  - NODE_ENV=production
- mapping de ports http:80:80 https:443:80
- Fix: "gatsby build" plante à cause de la gestion de .mjs par Wepback 4

@see gatsbyjs/gatsby#8583 (comment)
AlexandreBourdeaudhui pushed a commit to O-clock-Alumni/DeviensDev that referenced this issue Nov 16, 2018
- https://deviensdev-preprod.nico.oclock.io/
- déploiement sur PaaS Dokku (deviensdev-preprod)
- variables d'environnements :
  - DEVIENSDEV_GITHUB_TOKEN=...
  - ENV=production
  - NODE_ENV=production
- mapping de ports http:80:80 https:443:80
- Fix: "gatsby build" plante à cause de la gestion de .mjs par Wepback 4

@see gatsbyjs/gatsby#8583 (comment)
AlexandreBourdeaudhui pushed a commit to O-clock-Alumni/DeviensDev that referenced this issue Nov 16, 2018
- https://deviensdev-preprod.nico.oclock.io/
- déploiement sur PaaS Dokku (deviensdev-preprod)
- variables d'environnements :
  - DEVIENSDEV_GITHUB_TOKEN=...
  - ENV=production
  - NODE_ENV=production
- mapping de ports http:80:80 https:443:80
- Fix: "gatsby build" plante à cause de la gestion de .mjs par Wepback 4

@see gatsbyjs/gatsby#8583 (comment)
chikamichi added a commit to O-clock-Alumni/DeviensDev that referenced this issue Nov 16, 2018
- https://deviensdev-preprod.nico.oclock.io/
- déploiement sur PaaS Dokku (deviensdev-preprod)
- variables d'environnements :
  - DEVIENSDEV_GITHUB_TOKEN=...
  - ENV=production
  - NODE_ENV=production
- mapping de ports http:80:80 https:443:80
- Fix: "gatsby build" plante à cause de la gestion de .mjs par Wepback 4

@see gatsbyjs/gatsby#8583 (comment)
chikamichi added a commit to O-clock-Alumni/DeviensDev that referenced this issue Nov 17, 2018
- https://deviensdev-preprod.nico.oclock.io/
- déploiement sur PaaS Dokku (deviensdev-preprod)
- variables d'environnements :
  - DEVIENSDEV_GITHUB_TOKEN=...
  - ENV=production
  - NODE_ENV=production
- mapping de ports http:80:80 https:443:80
- Fix: "gatsby build" plante à cause de la gestion de .mjs par Wepback 4

@see gatsbyjs/gatsby#8583 (comment)
chikamichi added a commit to O-clock-Alumni/DeviensDev that referenced this issue Nov 17, 2018
- https://deviensdev-preprod.nico.oclock.io/
- déploiement sur PaaS Dokku (deviensdev-preprod)
- variables d'environnements :
  - DEVIENSDEV_GITHUB_TOKEN=...
  - ENV=production
  - NODE_ENV=production
- mapping de ports http:80:80 https:443:80
- Fix: "gatsby build" plante à cause de la gestion de .mjs par Wepback 4

@see gatsbyjs/gatsby#8583 (comment)
@AlexandreBourdeaudhui
Copy link
Author

AlexandreBourdeaudhui commented Dec 3, 2018

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 Gatsby@2.0.51 with the repo for reproduction. If i block the version in 2.0.50, i dont have any problem for build.

@AlexandreBourdeaudhui
Copy link
Author

AlexandreBourdeaudhui commented Dec 3, 2018

I see the changelog and see this commit : 8061e3b, in particular 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 ? 🚶

@gatsbot
Copy link

gatsbot bot commented Feb 4, 2019

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! 💪💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. status: needs more info Needs triaging and reproducible examples or more information to be resolved status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting.
Projects
None yet
Development

No branches or pull requests

3 participants