Closed ghost closed 6 years ago
When you get errors like that, you want to disable minimization by webpack so that you can see the development version of React which will show you the actual errors.
We used to in v1 have a build flag --no-uglify
which would do that for you but until this issue is fixed, you need to do it manually by editing node_modules/gatsby/dist/utils/webpack.config.js and searching for
config.optimizationand adding
minimize: false`
https://stackoverflow.com/questions/51263506/webpack-4-disable-uglifyjs-webpack-plugin
@tryzniak just did a PR actually fixing that issue in https://github.com/gatsbyjs/gatsby/pull/7243 so if you upgrade to gatsby@2.0.0-beta.98, you can use the --no-uglify
build flag.
Don't see Beta.98 release available under releases tab.. is it released ?
`success Building production JavaScript and CSS bundles — 15.023 s ⠁ Building static HTML for pages — 150/228 33.43 pages/second(node:17004) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
error Building static HTML for pages failed
See our docs page on debugging HTML builds for help https://goo.gl/yL9lND
20 | 21 | // Flag the module as loaded
22 | module.l = true; | ^ 23 | 24 | // Return the exports of the module 25 | return module.exports;
WebpackError: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.
bootstrap:22 invariant lib/webpack/bootstrap:22:1
static-entry.js:78 lib/.cache/static-entry.js:78:5
bootstrap:7 V lib/webpack/bootstrap:7:1
bootstrap:5 S lib/webpack/bootstrap:5:1
bootstrap:7 W lib/webpack/bootstrap:7:1
bootstrap:8 Object.map lib/webpack/bootstrap:8:1
bootstrap:22 a.render lib/webpack/bootstrap:22:1
bootstrap:21 a.read lib/webpack/bootstrap:21:1
bootstrap:32 renderToString lib/webpack/bootstrap:32:1
static-entry.js:145 Module../.cache/static-entry.js.__webpack_exports__.default lib/.cache/static-entry.js:145:16
bootstrap:24 Promise lib/webpack/bootstrap:24:1`
After upgrading to latest beta & using --no-uglify parameter above is the stack trace
@vishalniit Hmm, I've run GATSBY_ENV=development && gatsby build --no-uglify
and have no errors. What is build-css
? It would be great, if you could provide us with a reproduction repo.
@vishalniit the error is indicating that you're importing somewhere into one of your components the node.js module "buffer" which doesn't work in the browser. You can find that by opening the generated js file at public/render-page.js and looking through for where buffer is added and trace that back to a component. Or you can grep public for Buffer and find which js bundle file it's in and then use https://www.npmjs.com/package/source-map-explorer to look at the dependency tree for that bundle.
Closing as there's not I don't believe anything we can do to help more with this on our end.
@KyleAMathews that is warning that should not broke the build process.
Hi Kyle, During Develop, one of the pages throws this error in the browser console.
Uncaught TypeError: Illegal invocation
at setValueForProperty (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:2912)
at setInitialDOMProperties (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:7355)
at setInitialProperties$1 (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:7513)
at finalizeInitialChildren (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:8527)
at completeWork (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:14109)
at completeUnitOfWork (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:15714)
at performUnitOfWork (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:15891)
at workLoop (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:15908)
at renderRoot (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:15943)
at performWorkOnRoot (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:16574)
at performWork (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:16478)
at performAsyncWork (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:16451)
at callUnsafely (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:5354)
at idleTick (D:/Workspace/Gatsby_V2_Migration_Workspace/Backup/MT/node_modules/react-dom/cjs/react-dom.development.js:5446)
The above error occurred in the <LocationProvider> component:
in LocationProvider
in Location
in Router (created by Root)
in Root (created by HotExportedRoot)
in AppContainer (created by HotExportedRoot)
in HotExportedRoot
React will try to recreate this component tree from scratch using the error boundary you provided, AppContainer.
Any clue as to why its throwing this error?
@vishalniit is it a warning? We don't kill the build process on warnings.
@rtm619 could you please open a new issue with more instructions on how to reproduce this error.
I am still facing it @KyleAMathews.
funny thing is gatsby develop
is working fine, but with gatsby build
it starts breaking. Tried passing --no-uglify
/--noUglify
too.
error Building static HTML failed
See our docs page on debugging HTML builds for help https://gatsby.dev/debug-html
31 | var error;
32 | if (format === undefined) {
> 33 | error = new Error(
| ^
34 | 'Minified exception occurred; use the non-minified dev environment ' +
35 | 'for the full error message and additional helpful warnings.'
36 | );
WebpackError: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings .
- invariant.js:33 invariant
[lib]/[invariant]/invariant.js:33:1
- createBrowserHistory.js:46 createBrowserHistory
[lib]/[history]/lib/createBrowserHistory.js:46:140
- history.js:8 Module../lib/core/history.js
lib/lib/core/history.js:8:34
- bootstrap:19 __webpack_require__
lib/webpack/bootstrap:19:1
- index.js:1 Module../lib/core/index.js
lib/lib/core/index.js:1:1
- bootstrap:19 __webpack_require__
lib/webpack/bootstrap:19:1
- bootstrap:19 __webpack_require__
lib/webpack/bootstrap:19:1
- index.jsx:1 Module../lib/components/Form/index.jsx
npx gatsby --version
2.1.19
@KyleAMathews I don't think --no-uglify is working now - due to the change to terser seems likely?
I really need to build with 'the non-minified environment' at the moment; a quite obscure error in a router \<Redirect /> which works perfectly in develop.
Please advise -- thanks. All latest Gatsby/-cli.
p.s. tried your original idea to modify node_modules/.../webpack.config.js -- didn't work either
@narration-sd I think I've run into that same error with Redirect in production, any solutions?
I'm also unable to get a non-uglified build working which makes resolving this kind of prod only issue a huge problem.
@KyleAMathews
When you get errors like that, you want to disable minimization by webpack so that you can see the development version of React which will show you the actual errors.
Using the no uglify option (I tried --no-uglify and --noUglify) doesn't result in Webpack using the dev version for me. I still get the production mode. I am using Gatsby 2.15.x and I can see the option to not minimize is in webpack but still get the WebpackError: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
errors.
Ideas?
Also experiencing the above problem, workings on gatsby develop, fails on gatsby build
I am still experiencing the issue, why is it closed?
Still an issue, 2022
Still an issue in 2023.
still an issue 2024
Description
Gatsby Build is failing, while gatsby develop is working.
Steps to reproduce
set GATSBY_ENV=development && npm run build-css && gatsby build
Expected result
It should have succeed in Gatbsy Build
Actual result
`$ set GATSBY_ENV=development && npm run build-css && gatsby build
success open and validate gatsby-config — 0.012 s success load plugins — 0.319 s success onPreInit — 1.434 s success delete html and css files from previous builds — 1.315 s success initialize cache — 0.273 s success copy gatsby files — 0.188 s success onPreBootstrap — 0.001 s ⠁ :: starting to fetch data from Bazaarvoice :: ⠂ source and transform nodes :: fetching Bazaarvoice data is completed :: ⠄ source and transform nodesStarting to fetch data from Contentful Fetching default locale ⠄ source and transform nodesdefault local is : en-CA ⠄ source and transform nodescontentTypes fetched 43 Updated entries 0 Deleted entries 0 Updated assets 0 Deleted assets 0 Fetch Contentful data: 2166.855ms success source and transform nodes — 9.187 s success building schema — 2.322 s success createPages — 0.780 s success createPagesStatefully — 0.048 s success onPreExtractQueries — 0.026 s success update schema — 1.712 s warning Using the global
graphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js warning Using the globalgraphql
tag is deprecated, and will not be supported in v3. Import it instead like: import { graphql } from 'gatsby' in file: C:/StaticGenerators/Projects/fun/MT-MW-Braun-CA/src/utils/graphqlHelper.js success extract queries from components — 0.822 s success run graphql queries — 5.440 s — 119/119 21.88 queries/second success write out page data — 0.028 s success write out redirect data — 0.002 s success onPostBootstrap — 0.023 sinfo bootstrap finished - 29.406 s
success Building production JavaScript and CSS bundles — 44.608 s ⠂ Building static HTML for pages — 100/230 27.63 pages/second(node:6048) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
error Building static HTML for pages failed
See our docs page on debugging HTML builds for help https://goo.gl/yL9lND
31 | var error; 32 | if (format === undefined) {
WebpackError: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful wa rnings.
invariant.js:33 invariant [lib]/[invariant]/invariant.js:33:1
index.js:590 [lib]/[@reach]/router/es/index.js:590:1
react.production.min.js:18 V [lib]/[react]/cjs/react.production.min.js:18:48
react.production.min.js:16 S [lib]/[react]/cjs/react.production.min.js:16:210
react.production.min.js:18 W [lib]/[react]/cjs/react.production.min.js:18:388
react.production.min.js:19 Object.map [lib]/[react]/cjs/react.production.min.js:19:67
index.js:211 RouterImpl.render [lib]/[@reach]/router/es/index.js:211:1
react-dom-server.node.production.min.js:28 d [lib]/[react-dom]/cjs/react-dom-server.node.production.min.js:28:207
react-dom-server.node.production.min.js:28 ya [lib]/[react-dom]/cjs/react-dom-server.node.production.min.js:28:493
react-dom-server.node.production.min.js:33 a.render [lib]/[react-dom]/cjs/react-dom-server.node.production.min.js:33:46
react-dom-server.node.production.min.js:32 a.read [lib]/[react-dom]/cjs/react-dom-server.node.production.min.js:32:246
react-dom-server.node.production.min.js:43 renderToString [lib]/[react-dom]/cjs/react-dom-server.node.production.min.js:43:1
static-entry.js:145 Module../.cache/static-entry.js.__webpack_exports__.default lib/.cache/static-entry.js:145:16
error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`
Environment
File contents (if changed)
gatsby-config.js
: N/Apackage.json
: N/Agatsby-node.js
: N/Agatsby-browser.js
: N/Agatsby-ssr.js
: N/A