Error from the console. Please help

.env: line 1: syntax error near unexpected token `(’

5:07 PM

.env: line 1: `const mongoose = require(‘mongoose’);’

5:07 PM

internal/modules/cjs/loader.js:613

5:07 PM

throw err;

5:07 PM

^

5:07 PM

5:07 PM

Error: Cannot find module ‘./model/User’

5:07 PM

Require stack:

5:07 PM

Jump To- /app/router/user.js

5:07 PM

Jump To- /app/server.js

5:07 PM

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)

5:07 PM

at Function.Module._load (internal/modules/cjs/loader.js:526:27)

5:07 PM

at Module.require (internal/modules/cjs/loader.js:666:19)

5:07 PM

at require (internal/modules/cjs/helpers.js:16:16)

5:07 PM

Jump Toat Object. (/app/router/user.js:2:14)

I have check all this errors but cant help it please help. and i wont mind to invite you to the project to see those file if you drop your name at glitch thank you.

did you check .env for syntax errors?

Slightly more than syntax error I’d say. If this is in fact the .env file then it can’t contain javascript.

3 Likes

Please I don’t get it are you suggesting its …env error, that is from glitch Environment or…

Could you share your project here? It looks like you are placing JS code in an environment variable file.

1 Like

Glitch reads the .env file if I’m not mistaken and then uses the editor to edit the settings. Since it has .env in the error and says “line 1” and I see “mongoose” it looks wrong.

1 Like

thanks, [Glitch] is the link to my project [project name: ‘pass-req-form’] feel free to edit suggest and comment more. I equally sent you invitation to view this files your self if it please you.

1 Like

Make sure your .env file only has things like this:

password=1234
mongodb=2323232
token=vn3n3423423432

this is just an example, but it should have a similar format… No Javascript code in env!

1 Like

ok, [Glitch], is the project link and pass-req-form is the project name .fee free to edit comment and suggest more thanks.

1 Like

I took a look and it wasn’t your .env file so perhaps .env is something Glitch just outputs… on the other hand I couldn’t see it logging the message you referred to. I did see it fail consistently trying to access user.

1 Like

Something happened as I was reading things and at the moment I can no longer get to the project. It looked as if someone told it to reload while I was reading and now nothing.

Yeah I fixed the .env file, there was javascript code there.

well there you go!

Yeah but there still seems to be a error with accessing the User.js file.

1 Like

I will suggest that is best fixed by commenting anything not necessary to get it running and then gradually uncommenting each line to see which one breaks it.

I was trying to see if the require patch to user.js was correct when it went south.

2 Likes