Server cannot read module imported

thanks to tleylan and Quacky A.K.A not Martin.
the server.js can not read the module imported, where as the .env is solved. more hand please.
[pass-req-form] is the project name, the link is [Glitch].

Hi there - your logs say “Unexpected end of input” for “app/router/user.js”. In that file, most of the code is commented out, leaving a try block without a closing parenthesis or catch statement following it.

2 Likes

yes that is because, i was advice by a mate to comment out every code in that file, user.js and try to uncomment to notice where the problem lies. now try to come in again to help see the problem or i can invite you in, if you don’t mind. thanks for your attention .

I know you’re not blaming me :slight_smile: but you need to comment “code that isn’t needed to run” not one parenthesis out of two. It still has to be valid JavaScript :slight_smile:

Okay, I have taken time to erase the router file and where it serve to start over and identify the issue, I shall keep you posted.

Let me offer a tiny bit more advice. There is generally never a need to actually delete a .js file from a project in order to test how things work without it. You can rename it.

You can also comment where the original file is “required” which means no need to rename anything. And you can comment code within a module (when necessary).

In each case you are simply trying to get the project back to a state that “loads and runs”. Clearly it won’t do what you want until you solve the issue but you are trying to determine what the issue is.

I probably could find it but I would be doing what I am suggesting that you do, focus on finding the offending line or lines.

1 Like

advice taken. am suggesting this could be the problem affecting the file. After deleting the file i checked the console and discover that my mongoDB was not connected, which means the message i was getting from the console was as the result of that.
ERROR MESSAGE
MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you’re trying to access the database from an IP that isn’t whitelisted. Make sure your current IP address is on your Atlas cluster’s IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/

4:59 PM .

1 Like
  1. go to google and find out your ip
  2. In the Security section of the left navigation, click Network Access. The IP Access List tab displays.
  3. Click Add IP Address.
  4. copy and paste your IP and put it there.
  5. then save

Try that in the mongodb dashboard. If it doesn’t work change the IP from your IP to 0.0.0.0

1 Like

Let me try to see if I can add the IP to the whitelist. which is the error message. I open my mongodb with mlab. please if you know how exactly i can approach the error solution, let me know. else am sure i will

thanks Quacky, where were you? i was trying to get in touch with you but to no avail. well done, from here
Try that in the mongodb dashboard. If it doesn’t work change the IP from your IP to 0.0.0.0
did you mean my PC IP??? or mongodb IP??

You can easily just visit Cloud: MongoDB Cloud and login

Are you sure it was me??? I didn’t receive any messages on the forum.

I mean the mongodb IP…

1 Like

Hi Quacky, i have added o.o.o.o to the new IP address and its active. But am confuse cause, the ip i added to get URI was my pc ip so hope now that i added a different one from the network access its going to connect.
Again, should i clean up the old uri and write another ones or its still remain the same, since its the same user.