Yarn test - network request failed

created react project using create-react-app, however when i go to run yarn test

to check if 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 completely without making any changes to App.test.js, just trying to run the default test. yarn start

works great, deploys my app to browser.
Try uninstalling node_modules


Also tried and npm install

instead npm run tests

, but that doesn't install my dependencies and then also errors in tests.
OS: Antergos Linux
Github repo: https://github.com/Fenwick17/road-to-react-learning
I went through my commits to find the problem and it looks like it got triggered at https://github.com/Fenwick17 / road-to-react-learning / commit / 4b6069181a39861e531b550ebb8689695db042bb so I'll work with fixes.

+3


source to share


1 answer


I also ran into this problem while following the book "The Road to Learning React" and I think the part where it gets called is causing this error fetch

. The book forgot to include import for checkout, which is as follows:

import fetch from 'isomorphic-fetch'

      



Then it solves my problem like a charm. Hope this help.

+4


source







All Articles