created a react project using create-react-app however when I go to run yarn test
to see if the initial tests pass I get
/home/afenwick/Development/road-to-react-learning/node_modules/react-scripts/scripts/test.js:22
throw err;
^
TypeError: Network request failed`
error Command failed with exit code 1.
If I set up a brand new app it works totally fine, have not made any changes to App.test.js, just trying to run the default test. yarn start
works fine, spins up my app in the browser.
Have tried deleting node_modules
Also tried npm install
instead and npm run tests
but that doesnt install my dependencies and then also errors the tests.
OS: Antergos Linux
Github repo: https://github.com/Fenwick17/road-to-react-learning
Stepped through my commits to locate the issue, and appears to be caused in https://github.com/Fenwick17/road-to-react-learning/commit/4b6069181a39861e531b550ebb8689695db042bb so I will work through the changes to rectify.
I also ran into this problem when following the book entitled "The Road to Learn React" and I think that the one causing this error is the part where fetch
is called. The book forgot to include an import for fetch which is this one:
import fetch from 'isomorphic-fetch'
Then, it solves my problem like a charm. Hope this help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With