question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] react-static build fails with strange errors. yarn build succeeds

See original GitHub issue

a very simple project off the basic template fails to build with react-static build yarn build works fine

Environment

Run and copy the result of:

npx envinfo --system --npmPackages react* --binaries --npmGlobalPackages react* --browsers

here:

this command failed with zsh: no matches found: react*

I’m including my package.json here:

{ “name”: “react-static-example-basic”, “private”: true, “scripts”: { “start”: “react-static start”, “stage”: “react-static build --staging”, “build”: “react-static build”, “analyze”: “react-static build --analyze”, “serve”: “serve dist -p 3000” }, “dependencies”: { “@reach/router”: “^1.2.1”, “axios”: “^0.19.0”, “react”: “^16.9.0”, “react-dom”: “^16.9.0”, “react-static”: “^7.2.0”, “react-static-plugin-reach-router”: “^7.2.0”, “react-static-plugin-sitemap”: “^7.2.0”, “react-static-plugin-source-filesystem”: “^7.2.0” }, “devDependencies”: { “babel-eslint”: “^10.0.2”, “eslint”: “^6.1.0”, “eslint-config-react-app”: “^5.0.1”, “eslint-config-react-tools”: “^1.1.7”, “eslint-plugin-flowtype”: “^4.2.0”, “eslint-plugin-import”: “^2.18.2”, “eslint-plugin-jsx-a11y”: “^6.2.3”, “eslint-plugin-react”: “^7.14.3”, “eslint-plugin-react-hooks”: “^4.0.2”, “serve”: “^11.1.0” } }

Steps to Reproduce the problem

Base your steps off of any freshly installed react-static template!

  1. create a blank or basic template with latest react-static 7.4.2 version
  2. add a couple simple static routes
  3. react-static build --staging --debug

build fails with strange errors like:

TypeError: Failed exporting HTML for URL talent/3318 (react_static_root/src/containers/Star): Cannot convert undefined or null to object

Expected Behavior

Project should build with no errors using react-static build OR yarn build

Reproducible Demo

I have uploaded a demo repo here: https://github.com/augustosamame/react-static-demo

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jkatofskycommented, Jan 8, 2021

Just wanted to jump in and say that using yarn also fixed all of the issues that I described in this ticket.

1reaction
augustosamamecommented, Dec 30, 2020

Thanks. So what would be the fix in my case? Should I just keep using yarn build? I don’t want this to sound as a criticism of a great (and open source) library. But it has been a major hassle to get react-static up and running. I tried everything to get this to work, but kept getting different and cryptic errors, with both basic and empty templates. I kept at it and just stumbled into everything working just fine with yarn build, but I would imagine many first-time users just follow the instructions in the Readme, they see it doesn’t work and move on. I would suggest fixing the initial experience so it works out of the box.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"yarn build" fails to build in Windows 10 #1389 - GitHub
How to reproduce the error Run the following command yarn build Detailed Error Message PS C:\misc\sources\Github\pr\reactjs.org> yarn build ...
Read more >
Getting an error during yarn build in React JS - Stack Overflow
I've removed the node_modules and re-ran the yarn install and yarn build again. reactjs · build · node-modules · react-scripts · Share.
Read more >
How to fix build failures with `create-react-app` in production
If your build is using create-react-app and has been failing since approximately the 18th of June 2020, this post will help you fix...
Read more >
Troubleshooting Common Errors - Gatsby
Try running npm list sharp or yarn why sharp to see all packages in the current project that use sharp and try updating...
Read more >
Need help with React install - The freeCodeCamp Forum
I wanted to start a new React project so I went about my usual route: npx create-react-app app-name-here.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found