I’m developing a React App which displays washing machines, I would be very grateful for help with this. I keep getting this error message when I test the server code:
C:\Users\info>npm start washing machine
npm ERR! path C:\Users\info\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open ‘C:\Users\info\package.json’
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\info\AppData\Roaming\npm-cache_logs\2019-07-12T15_34_10_852Z-debug.log
Thanks for responding so swiftly, hope you’re well…I’m away from my laptop but no I do not have package.json defined at the location the error is mentioning.
You were really helpful last time I asked a question, do you have a tutorial that will fix this problem please?
How did you create the project? If you used create-react-app, it may be easier to just create a new project and copy/paste your code into it. Fixing environment configuration errors is often a challenge.
One thing that will help you in the future is to pay attention to the error message and what it is trying to tell you. While error messages sometimes don’t help you a lot, they almost always do give you some information to help you figure out where to start looking
For this error, it seems like something is wrong between lines 48 and 49 based on the message and it involves something with the code in your return block. If you look at your code editor, you should see some adequate visual cues that something is up as well:
What this looks like is you have some element or tag that isn’t properly closed off. That loosely matches the error you see as well. I don’t know if what I’m about to paste will fix your issue, for I don’t have your full project. All I did was ensure that spaces and line breaks were properly inserted to ensure everything was syntactically valid and avoid this particular error
Also note that you had componentDidMount capitalized. The proper use for it is in a lower-case form. Otherwise, the React code won’t actually call it.
Properly formatting your document will help you greatly in ensuring your code is easily readable and contains fewer errors around missing closing tags, brackets, parentheses, etc.