Link to home
Start Free TrialLog in
Avatar of Jimbo99999
Jimbo99999Flag for United States of America

asked on

Help with running my Node project

Hello experts.  I am having some trouble running one of the group projects we created in our bootcamp.  If I may, describe the issue and can you recommend which additional files to attach to help with the detective work?

This was a working project that we presented(it was on a different laptop than mine).  I pulled it down from Github onto my laptop.  I worked through a few roadblocks and I do have it running on my localhost. Unfortunately, the html page that is loaded is blank.  When I open the html file in a Sublime  there is no markup in it.  I attached the index.html file.  There are comments in it I do not understand.  I was responsible for the backend while another team member took care of the frontend

Here is what I have in the server.js file for the html page:

app.get(function(req, res) {
   res.sendFile(path.join(__dirname, "./client/public/index.html"));

I attached a screen print of the browser console when the index.html file opens empty.

Thank you for your patience and help,
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Generally, when writing a Node app, you create the source files, and then you 'build' your application. The build process is responsible for compiling all of your assets into usable files, and injecting them into the index file. Often, the built assets will be placed in a specific folder such as 'dist' or 'build'

You run the build process by running one of the scripts available in your package.json file such as dev, build, test etc:

npm run build

Generally, there is also a dev script to allow you to launch a server for testing:

npm run dev
Avatar of Jimbo99999


Thank you. I will try tonight.

I did not have much luck.  I do not understand why there are 2 package.json files.  

There is one in the same location as my server.js file.  I  navigated in Bash to the path where server.js file is located. When I type node server.js and then check localhost that is when I get the blank screen.  

Then up one level in the client folder there is another one.
So, in light of finding the second package.json file, I navigated in Bash into the client folder.  Then tried npm run start and received message " 'react-scripts' is not recognized as an internal or external command".  

Can you offer suggestions on what to try next?  

Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for the help. It is working now!