Need advise on error messages

@thecil
@zsolt-nagy

I had some problems after entering the following in the console as per the class video:

setInterval( () => console.log(‘done’), 1000)

  • the result ‘done’ every second continued even after i cleared the console. Then I got many error messages as I was trying to enter something else in the console to over-ride this command so I closed the browser and the text editor.

  • when i ran npm start again in the text editor to resume what I was doing, it said that port 3000 was being used did I want a new port. I said no and restarted computer.

  • then npm start again

  • then it said production was not optimized and to type:

npm run build (I’ve never seen this message before)

So, I’m not sure if I should have done that and what it has done to my environment for developing going forward. Here is the screen shot.

Can you advise. Can I reverse this? Can I just go back to the normal state? Revert back to before I entered “npm run build”

I don’t know why I keep running into these issues.

Thanks,
Julie

HI @Julie66,

  1. You need to terminate the program before working on anything else. You have to do “Cntrl+C” to stop the program.

  2. yes, the port will be used if you do not terminate the application. (Even though you closed the editor and browser). So, next time when you do npm start and then want to close the app, terminate it by “Cntrl+C”.

  3. npm run build only creates a package for deployment purposes. You do not need to do that. Can you share your git repo or at least more screenshots (the npm start screenshot) ? When an application-level issue comes, it is difficult to debug using only snippets of codes.

These are not issues, these are points that you will slowly learn in the process. You should be happy that you are learning all these things at the starting of your journey. :smiley:

Hope this helps. Looking forward to hearing from you.

1 Like

I’d also encourage you to research some points online to train your problem solving skills.

Example: googling how to use setInterval leads you to a page like this: https://www.w3schools.com/jsref/met_win_setinterval.asp. You can read the whole page to learn about this topic, and then you conclude near the middle that you can save an interval id and then call clearInterval with that id to get rid of the messages.

These problem solving skills will be needed once you start working as a software developer.

Reloading the browser window also removes the setInterval messages if you hadn’t saved the ids. Clearing the console does not reload the page, therefore, it cannot stop a setInterval.

2 Likes

Hi, Thanks for the response. I will try that next time.

As for the npm run build, I now have a build file and an .eslintcache file. Can I simply delete these files? Here is the screen shot:

Hi @Julie66,

This file is not supposed to be in your directory, this is a bug from the side of create-react-app. They working on resolving the issues, it is ideally kept in the node_modules directory.

Do not delete this file because it is there to check your syntax and best practices. eslint is a linter package which double checks your syntax and provides feedback, the cache file is created so that it doesn’t have to check your entire code base again and again. Therefore, your code files that have not been changed are cached whereas the code files you type on will be scanned again to check for syntaxes.

Hope this makes it clear.