[Bug] "An error occurred loading this page's template" since v7
See original GitHub issueReporting a bug?
Provide as much information as you can to reproduce the issue. If the issue is not reproducible, it can’t be fixed!
Environment
Run and copy the result of:
npx envinfo --system --npmPackages react* --binaries --npmGlobalPackages react* --browsers
here:
System:
OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Memory: 177.36 MB / 7.52 GB
Container: Yes
Shell: 5.4.2 - /bin/zsh
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
Yarn: 1.16.0 - /usr/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
Browsers:
Chrome: 74.0.3729.169
Firefox: 67.0
npmPackages:
react: ^16.8.6 => 16.8.6
react-dom: ^16.8.6 => 16.8.6
react-ga-donottrack: ^1.0.0 => 1.0.0
react-hot-loader: ^4.8.4 => 4.8.4
react-markdown: ^4.0.8 => 4.0.8
react-static: ^7.0.10 => 7.0.10
react-static-plugin-sass: ^7.0.10 => 7.0.10
react-static-plugin-typescript: ^7.0.10 => 7.0.10
react-syntax-highlighter: ^10.2.1 => 10.2.1
of course include any other package versions here if relevant.
Steps to Reproduce the problem
Base your steps off of any freshly installed react-static template!
It’s a somewhat difficult problem because it doesn’t appear to be completely reproducible every time. These steps result in the problem some of the time. I have the feeling that it mostly occurs when the site is freshly loaded.
- Visit https://vincenttunru.com
- Click on one of the posts, e.g. “Fearless deployments”
- Hopefully see “An error occurred loading this page’s template. More information is available in the console.” The console then shows: “Error: export not found” in
vendors~main
.
When you then navigate to a different page, the page goes completely black with the message:
An internal error occured!
Please see the console for more details.
And the console says:
Invariant Violation: "Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
It appears to be easier to reproduce when the site has not been visited for a couple of minutes…
This occurs in both Firefox and Chrome. I think it does not occur when the console is open. It also does not occur when you visit a page directly. Any pointers to other things I should investigate would be welcome.
Expected Behavior
The expected page should just be shown every time I click a link there.
Reproducible Demo
Source code of the website is here: https://gitlab.com/vincenttunru/blog
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:40 (18 by maintainers)
Ok, here’s how to “fix” it. Although be aware, it’s a horrible hack.
Create a local plugin:
Plugin contains a copy of .js files from node_modules/react-universal-component/dist (very bad).
You need to edit
plugins/react-static-plugin-fix-universal-component/react-universal-component/index.js
and comment out this section in “preload” static function:Then node.api.js contents:
Then .babelrc.js:
While it all is a horrible hack, but that’s the essence of the problem there.
This is the bug I believe, had the same issue spent a few hours debugging: https://github.com/faceyspacey/react-universal-component/issues/198
tl;dr: