[Bug] react-static build fails with strange errors. yarn build succeeds
See original GitHub issuea 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!
- create a blank or basic template with latest react-static 7.4.2 version
- add a couple simple static routes
- 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:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Just wanted to jump in and say that using yarn also fixed all of the issues that I described in this ticket.
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.