Gatsby: [v2] Error during building static HTML for pages

Created on 17 May 2018  Â·  4Comments  Â·  Source: gatsbyjs/gatsby

Description

Using the latest version of gatsby@2, I get the following error during gatsby build:

$ gatsby build
success delete html files from previous builds — 0.051 s
success open and validate gatsby-config.js — 0.008 s
success copy gatsby files — 0.113 s
success onPreBootstrap — 1.514 s
success source and transform nodes — 0.129 s
success building schema — 0.285 s
success createPages — 0.047 s
success createPagesStatefully — 0.053 s
success onPreExtractQueries — 0.001 s
success update schema — 0.112 s
success extract queries from components — 0.089 s
success run graphql queries — 0.057 s
success write out page data — 0.008 s
success write out redirect data — 0.002 s
success onPostBootstrap — 0.001 s

info bootstrap finished - 10.422 s

⢀ Building production JavaScript and CSS bundlesDEPRECATION WARNING on line 6, column 50 of stdin:
The value "#29b6f6aa" is currently parsed as a string, but it will be parsed as a color in
 coâ   Building production JavaScript and CSS bundlesntinue parsing it as a string.

DEPRECATION WARNING on line 6, column 61 of stdin:
The value "#ffd60088" is currently parsed as a string, but it will be parsed as a color in
future versions of Sass. Use "unquote('#ffd60088')" to continue parsing it as a string.

success Building production JavaScript and CSS bundles — 8.862 s
⢀ Building static HTML for pagesDEPRECATION WARNING on line 6, column 50 of stdin:
The value "#29b6f6aa" is currently parsed as a string, but it will be parsed as a color in
future versions of Sass. Use "unquote('#29b6f6aa')" to continue parsing it as a string.

DEPRECATION WARNING on line 6, column 61 of stdin:
s a â   Building static HTML for pagesstring, but it will be parsed as a color in
future versions of Sass. Use "unquote('#ffd60088')" to continue parsing it as a string.


error Building static HTML for pages failed

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

  35 |  * }
  36 |  */
> 37 | exports.replaceRenderer = true
     |         ^
  38 |
  39 | /**
  40 |  * Allow a plugin to replace the static router component.


  WebpackError:

  - api-ssr-docs.js:37 NativeCompileCache._moduleCompile
    lib/.cache/api-ssr-docs.js:37:9

  - api-runner-ssr.js:36 Module._compile
    lib/.cache/api-runner-ssr.js:36:28

  - loader.js:53 Object.Module._extensions..js
    lib/.cache/loader.js:53:9

  - json-store.js:74 Module.load
    lib/.cache/json-store.js:74:12




  - api-runner-ssr.js:25 require
    lib/.cache/api-runner-ssr.js:25:3

  - universalModuleDefinition:7 Object.<anonymous>
    lib/webpack/universalModuleDefinition:7:1

  - api-runner-ssr.js:42 Module._compile
    lib/.cache/api-runner-ssr.js:42:4

  - bootstrap:7 Object.module.exports
    lib/webpack/bootstrap:7:1


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Steps to reproduce

  1. Clone https://github.com/simonyiszk/mvk-web/tree/aef3ff372b368afb0d2464d749733ba2db9e016a
  2. Install dependencies using Yarn
  3. Run yarn build

Environment

  • Gatsby version (npm list gatsby): 2.0.0-alpha.38
  • gatsby-cli version (gatsby --version): 2.0.0-alpha.38
  • Node.js version: 8.11.1
  • Operating System: Windows 10 x64

File contents (if changed)

See https://github.com/simonyiszk/mvk-web/tree/aef3ff372b368afb0d2464d749733ba2db9e016a.

help wanted stale? bug

Most helpful comment

Thanks for including the repo link. It looks like Gatsby is eating your original error message which is something like:

./src/pages/index.module.scss
Module build failed: /dev/mvk-web/src/data/assets/conference.jpg:1
(function (exports, require, module, __filename, __dirname) { ����
                                                              ^

SyntaxError: Invalid or unexpected token
    at new Script (vm.js:74:7)
    at NativeCompileCache._moduleCompile (/dev/mvk-web/node_modules/v8-compile-cache/v8-compile-cache.js:226:18)
    at Module._compile (/dev/mvk-web/node_modules/v8-compile-cache/v8-compile-cache.js:172:36)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Module.require (internal/modules/cjs/loader.js:626:17)
    at require (/dev/mvk-web/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/dev/mvk-web/src/pages/index.module.scss:7:231)
    at Module._compile (/dev/mvk-web/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
    at Object.module.exports (/dev/mvk-web/node_modules/gatsby/dist/utils/webpack-extract-css-modules-map.js:16:5)
 @ ./src/pages/index.jsx 6:0-41 9:13-19 13:13-19
 @ ./.cache/sync-requires.js
 @ ./.cache/static-entry.js

Your actual error could be related to issue #3665, as removing the url() in ./src/pages/index.module.scss allows the site to build.

For this issue it looks like the reporter is trying to use sourcemaps to create a more useful error message. But in this case it seems like the error is already pointing to the source files, so the processed error ends up being incorrect.

The original error is handled here, and then run through prepareStackTrace which is where the original info is lost.

All 4 comments

Thanks for including the repo link. It looks like Gatsby is eating your original error message which is something like:

./src/pages/index.module.scss
Module build failed: /dev/mvk-web/src/data/assets/conference.jpg:1
(function (exports, require, module, __filename, __dirname) { ����
                                                              ^

SyntaxError: Invalid or unexpected token
    at new Script (vm.js:74:7)
    at NativeCompileCache._moduleCompile (/dev/mvk-web/node_modules/v8-compile-cache/v8-compile-cache.js:226:18)
    at Module._compile (/dev/mvk-web/node_modules/v8-compile-cache/v8-compile-cache.js:172:36)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Module.require (internal/modules/cjs/loader.js:626:17)
    at require (/dev/mvk-web/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/dev/mvk-web/src/pages/index.module.scss:7:231)
    at Module._compile (/dev/mvk-web/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
    at Object.module.exports (/dev/mvk-web/node_modules/gatsby/dist/utils/webpack-extract-css-modules-map.js:16:5)
 @ ./src/pages/index.jsx 6:0-41 9:13-19 13:13-19
 @ ./.cache/sync-requires.js
 @ ./.cache/static-entry.js

Your actual error could be related to issue #3665, as removing the url() in ./src/pages/index.module.scss allows the site to build.

For this issue it looks like the reporter is trying to use sourcemaps to create a more useful error message. But in this case it seems like the error is already pointing to the source files, so the processed error ends up being incorrect.

The original error is handled here, and then run through prepareStackTrace which is where the original info is lost.

Hello, I had this same error, the solution after the hours of problem search, I found the pages that did not make a default export and obtained the same name, resulting in a form with the same name and so solves it. If I did not know how to express can write to me [email protected]

Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open!

This issue is being closed due to inactivity. Is this a mistake? Please re-open this issue or create a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

totsteps picture totsteps  Â·  3Comments

rossPatton picture rossPatton  Â·  3Comments

timbrandin picture timbrandin  Â·  3Comments

3CordGuy picture 3CordGuy  Â·  3Comments

kalinchernev picture kalinchernev  Â·  3Comments