Gold Medal Metrics bug

Cumulative Project: Gold Medal Metrics Solution
Web Development path
SQL
Broken functionality in solution.

For the Post:

Summery of the report:
“Gold Medal List” section is not filtered by country regardless of search input.

Course URL:
https://www.codecademy.com/paths/web-development/tracks/sql-for-web-development/modules/project-gold-medal-metrics/informationals/bapi-p5-gold-medal-metrics-solution

Steps to Reproduce:
Install dependencies, start server, start index.html, search by country, refer to bottom pane.

Fix or Workaround:
No clue.

Please attach screenshots

Not totally sure this is the question but the City column shows where the Olympics were held that year. Since the Search input specifies the country that Won the medals (Australia in the screenshot) the City list will still include all the cities around the world where the Olympics were held when Australia got medals.

Steps to Reproduce:
Install dependencies, start server, start index.html, search by country, refer to bottom pane

Non of these are working with me. I’m receiving message cannot find loader.js when trying to start server.js. Cannot open index.html with bash. like the whole project is broken. :confused:

Which version of Node are you using? I had better luck using Node 8 with some of the projects using sqlite3. You can use nvm to switch between different versions.

node v12.14.1
npm v6.13.4
are the versions. Now it works. I created both tables and it starts running. Not sure that this fixed the problem. But still cannot start index.html from bash or run the app.

Do you remember if there were error messages on npm install? I was first running Node 12 as well but that gave me lots of error messages when running npm install. I think the main issue was related to sqlite3 for Goldmedals. Downgrading to Node 8 solved the issue for me and gave just some minor messages. It is really easy to switch versions with nvm. If I type node -v in my current lesson in Codecademy it shows that they are using Node 7. I would give it a try to go back to v8, reinstall and see how it goes. I used v8.9.3.

1 Like

That’s certainly a valid way to interpret however, I’m not sure that was clear in the project unless you know your Olympic history. Thanks for your help!

I downgraded Node version to v8.9.3. and still got the same many errors and another one - Cannot find ..node_modules\sqlite3\lib\binding\node-v54-win32-x64\node_sqlite3.node. Then I have found an article that advised me to run - npm rebuild. That command fixe everithing and now on npm run start everything is ok (I mean no errors)… But stil this application does not want to run and I cannot see how it works. :confused:

Rather than downgrade node, try the following:

  • npm outdated and enter to list deprecated packages
  • Then, npx npm-check-updates -u and enter to update all packages
  • Finally, type npm install to complete the updates and update the package.json file

Did you do the other steps in the beginning of project such as open index.html and run node server.js?

Yep, when I try node server.js, it says everything is loaded and nothing more. It is look like the app running but no pages, no browsers. Starting webpack and index.html leads me to error shown on attached pic.

.

Also just updated all packages and then npm run start:
Says: Data successfully loaded and that is all… no app for browsing, no browsers, no pages…

As far as I can recall, the server script doesn’t open in the browser automatically. Follow the steps I outlined above (after navigating to within the project directory), then use your browser to navigate to localhost:0000 (where 0000 is the port number defined in your script).

Tried many times and different ways and this is the result:

Can you post your code and console errors (if any)?

Steps are:

  1. npm run start
  2. calling http://localhost:3001/ from browser
    Then page load Error page that says Cannot GET /
    and pic from the console:

I would consider unpacking the project file in a new directory and starting from scratch. You can always copy your written code over to the new files later on. Possible there is an issue in your index.html based on the msg. You should definitely see some tables and graphics when opening index.html manually. However, the data will only populate if the server runs successfully. It was a while ago I did this project but make sure to follow the exact steps in the beginning of the project. You have to actually open the index.html file manually in the browser as well as starting the server with node server.js. This manual procedure is different from some of the other projects which used create-react-app.

This result (Cannot GET / ) is expected even when the project works if trying to access at http://localhost:3001/

The server is sending info on localhost 3001 but there is nothing on the ‘/’ root. However, for example http://localhost/country/norway would send the “Norway” object (once the server is running and you have written the SQL queries for the applicable routes. The key is to open index.html manually to start the “front-end” up. I agree this could have been explained a little better.

If opening manuali index means to use command: npm run webpack open index.html while server running, then this does not work with me. I’m getting error. From my last attempt a minute ago:


If you can give me the starting comands step by step I’ll be grateful, because so far I’ve tried so many options…

First, make sure to have done the first steps without major error messages:
npm install
npm run webpack

Then I think the next step is where the problem is. Instructions say to “open index.html”. This is NOT to be taken literally and simply refers to using the web-browser (for example chrome, edge or safari) and opening a local file on your hard-drive with your browser. In Chrome you can press CTRL-O to get a prompt for opening local files. I am running Windows 10 with WSL2 (Ubuntu Linux) so I do it slightly different (wslview index.html in my case). From windows command prompt you could do “explorer index.html”. Navigate to the index.html file and open it from the browser. So it depends a bit on your OS but hopefully this will help.

I followed:

Linux

In Ubuntu or similar distributions:

  1. Open your terminal and run sudo apt-get install sqlite3 . Otherwise, use your distribution’s package managers.
  2. Try typing in the command sqlite3 newdb.sqlite . If you’re presented with a sqlite> prompt, you’ve successfully created the sqlite3 command for your terminal. You can exit by typing .exit in the prompt and pressing enter.

and was successful.

I followed the instructions for this project, but when it came to

To start your server, run node server.js . Refresh your browser to collect the information from the server.

I got an error. I downloaded sqlite3 successfully, so what is happening?