ExpDev07 / coronavirus-tracker

🦠 A live tracker and visualization of the coronavirus (2019-nCoV). Consists purely of a frontend written in EmberJS.
https://expdev07.github.io/coronavirus-tracker
11 stars 12 forks source link

Error after NPM Start #2

Closed ojsimon closed 4 years ago

ojsimon commented 4 years ago

Hi,

I am getting an error after NPM start.

`Error proxying to http://localhost:5000
connect ECONNREFUSED 127.0.0.1:5000

Stack Trace and Error Report: /var/folders/xk/mqjzccjn72qc3p97sp2p2gdc0000gp/T/error.dump.81b580ed715401808ace435ffb4d9df7.log`

How do I fix this?

Also the count of infected seems to be a bit behind other sources. How frequently does it update?

Thanks

ExpDev07 commented 4 years ago

It tries to reach the corona-tracker-api, but you don’t have one running locally at port 5000, hence the error. Simply follow the installation process of the API if you want one running locally.

The numbers are up-to-date with JHU’s cvs timeseries files. It’s simply our data-source that’s a bit behind, nothing to do with the API.

ojsimon commented 4 years ago

Does it have to be running locally? Is it not possible to just link to the hosted version of the API at https://coronavirus-tracker-api.herokuapp.com/v2/locations ? Do I have to create another instance of it at Heroku?

Thanks

ExpDev07 commented 4 years ago

@ojsimon Yes, that is possible, you can change the URL in config/enviroment.js. Make sure to also start your app through ember serve and not npm start then to run without --proxy.

ojsimon commented 4 years ago

@ExpDev07 I tried that, but after ember serve got an error for the tracker section.

So if I want to push to Github pages, basically I should clone to a new repo. Then I should run NPM install In the directory of the new repo. Then npm run deploy after that git commit to the new github repo.

Is that correct?

Because when I do that the page loads blank https://ojsimon.github.io/COTAPO/

Any suggestions?

Thanks

ExpDev07 commented 4 years ago

You need to set your GH-pages to point to the newly created branch which holds the dist files.

ojsimon commented 4 years ago

@ExpDev07 it is currently pointed at gh-pages branch (which I guess has the dist files)?.

ExpDev07 commented 4 years ago

No, your site shows the README file. How does your gh-pages branch look like

ojsimon commented 4 years ago

@ExpDev07 I had just changed it to master branch. I have changed back to gh-pages branch and it is blank.

ojsimon commented 4 years ago

What do you suggest?

ExpDev07 commented 4 years ago

Open console. Any errors?

ojsimon commented 4 years ago

@ExpDev07 No errors from deployment in console. I just tried all the steps again with a new cloned repo and still getting the same blank page issue. https://ojsimon.github.io/tra/

I also tried adding "homepage": "https://ojsimon.github.io/tra/", to the package.json file.

Any other ideas as to what is causing this?

ExpDev07 commented 4 years ago

Yup, right, if you view source, you see that it's trying to retrieve the javscript from

<script src="/coronavirus-tracker/assets/vendor-4a26dd7ea8ff785965ad9fc6fe8cf27e.js"></script>
<script src="/coronavirus-tracker/assets/coronavirus-tracker-0aadc30bc2368a84b02b07a62149764c.js"></script>

However, you need it to retrieve from /tra/..., not /coronavirus-tracker/.... Simply go into config/enviroment.js and change modulePrefix to tra or you can go down to where it says

if (eviroment === 'production') {
  // ENV.rootURL = ENV.modulePrefix + '/';
  // change to:
  ENV.rootURL = 'tra/';
}

Either way works, you should probably use the second option though and keep the modulePrefix as coronavirus-tracker. tra doesn't really make much sense.

ojsimon commented 4 years ago

@ExpDev07 I did that the first method.

It still does not work though. Now the page is showing with a black background but nothing loads.

Thanks for your help.

ExpDev07 commented 4 years ago

Looks like you gotta do the second method. Change modulePrefix back to coronavirus-tracker and just modify the root url to tra/ in production. Looks like changing modulePrefix has a lot more side effects.

ojsimon commented 4 years ago

Thanks that worked. Really appreciate your help here.

ExpDev07 commented 4 years ago

No problem :) I've been so busy with the API that the dashboard itself hasn't been updated since the beggining of v1 of the API aha, so it's using the old endpoints. Feel free to update it though.