Error: Cannot find module (heroku deploy error) - node.js

I have been trying to deploy my MERN app and but am getting this error.
This is the error i have been getting every time it try to deploy the mern app on heroku it's getting deployed but then in logs i am getting this error and link is also not working
refer to this screenshot

Why do you export your model like that??
What happen if you only require the file
const generalUser = require("../models/GeneralUsers.js")

Related

How to configure node js application for deployement with mongo DB and vercel?

I finished an application with JS, Mongo Db Atlas, and node Js(express). It works fine locally on my computer.
I am trying to put it online with vercel. I have linked my vercel account to Github. The front end part of my application works fine but every request to the backend don't work...
This is the error message that i get :
Failed to load resource: net::ERR_CONNECTION_REFUSED.
Is there somethin that i am supposed modify in my code when I put it online ?
My request still look like this :
const fetchCardList = () => {
fetch("http://localhost:5000/api/card/")
.then((reponse) => reponse.json())
.then((allSpikemmon) => {.................
Am i supposed to replace localhost:5000 by something ?
Thanks a lot !

Error on My heroku app when adding new user to MongoDB

so I have a controller on my app to add new officers like this
when I develop it on my localhost server it worked just fine however when I deploy it on heroku then try it again I received this error
I'm new on heroku and I honestly can't find out how to fix this can someone help me?
I'm using mongoose and mongoDB atlas btw
The data however successfully got inserted even tho the app got the error

cannot read properties of undefined (reading'errors')

enter image description here
I'm new to full-stack development.
I'm running my application on localhost, node.js for backend, react js for front-end, and MongoDB
everything is connected to the localhost when I try to login from the admin dashboard this error is shown any help
the error.networkError.result value is undefined, so there is no there is no undefined.errors try console.log(error.networkError) and go through the keys maybe also console.log(Object.keys(error.networkError))

Node website gives error on the server that doesn't exist on localhost. The files are the same

I am developing a website on localhost:3000. Everything works fine. I've added another query and it's loading properly. When I push to AWS server via github I'm getting an error
Uncaught SyntaxError: Unexpected token ';'
In routes I have added only mygraph4, everything was working properly on the server before.
Promise.all([queries.queryTable(thequery1), queries.queryTable(thegraphquery), queries.queryTable(thegraphquery2), queries.queryTable(thegraphquery3), queries.queryTable(thegraphquery4)])
.then(
data =>
res.render('tabs', {
'mydata2': JSON.stringify(data[0]),
'mydata1': JSON.stringify(data[1]),
'mygraph2': JSON.stringify(data[2]),
'mygraph3': JSON.stringify(data[3]),
'mygraph4': JSON.stringify(data[4]),
'mylittleuser': req.app.locals.myuser
})
);
On view.handlebars
var myjsongraphdata4 = {{{mygraph4}}}; this comes empty on the production server.
I've checked the files on the production server and they are the same. My only idea is to delete the whole project on the server and pull it again from github but maybe this time will get even more issues.
Why does it refuse to load the last query? It's using the same database, same table, same connection as the other queries that are working.

Deploying Node.js, React.js, Express, and Socket.io Application on Heroku

enter image description hereSuccessfully deployed to Heroku and most of our application is working. However, our socket.io pieces (chat, view online users, game updates) are not functioning. We think this may be due to having an instance of socket initialized in the Board.js component and also in the App.js file but not sure if that is the issue or how to resolve.
GitHub: https://github.com/sranney/checkers
Heroku App: https://afternoon-thicket-28146.herokuapp.com/
Any help is greatly appreciated Photo1 1: Server Config for Http Server Photo 2: Shows Proxy Photo 3: Configuring socket in app component Photo 4: Importing socket into app
It looks like you are missing an io.connect statement in your server.js file. Check out this video (https://www.youtube.com/watch?v=y5tRiFJuNOs) along with the source code in the description.

Resources