Why cant heroku find my node modules when deploying? - node.js

When I deploy I get the error Cannot find module '../../models/User' but my
solution works fine locally. here is a pic of my console console log of errors and a link to the repo https://github.com/No-MyNameIs/trashalbums
I understand similar questions have been presented and I worked through those solutions before presented and I tried working through those below with no luck. Any help would be appreciated.
Heroku deploy Error: Cannot find module - compilation
Heroku Cannot find module
console log of errors

The version of Node.js that will be used to run your application on Heroku, should also be defined in engines section of your package.json file.
For example:
"engines": {
"node": "11.0.0",
},
docs: https://devcenter.heroku.com/articles/deploying-nodejs#specify-the-version-of-node

Related

App deployed on Vercel "Cannot find module '#redis/client'" but it works locally

My app is an API that serves data from a Redis db. It works all fine locally, but once deployed on Vercel I get this error:
undefined ERROR Cannot find module '#redis/client'
Require stack:
- /var/task/node_modules/redis/dist/index.js
- /var/task/helpers/redis.js
- /var/task/models/model.js
- /var/task/routes/routes.js
- /var/task/api.project.js
- /var/task/___now_launcher.js
- /var/runtime/index.mjs
Did you forget to add it to "dependencies" in `package.json`?
Cannot find module '#redis/client'
The app is successfully deployed but it actually fails to run.
I just use the package "redis": "^4.0.2" locally, but i tried to install the specific package #redis/client": "^1.4.2 as well to see if it'd fix the problem in Vercel. But the problem persists.
How to fix this?

Node JS issue with hosting on Heroku 'Cannot find module'

I tried multiple ways to fix this issue (add/ modify Procfile, modify package.json...) but still not able to fix it. It would be appreciated if you can give me a hand, thanks in advance.
Here is the Heroku log:
Here is Github:
https://github.com/rainpaul/mern-family
add/ modify Procfile, modify package.json
After set Procfile to web: npm start, received new Heroku logs:
enter image description here
UPDATE:
Now I get new error, please help:
enter image description here
Try running the script you have defined in your package.json from your Procfile:
web: npm start
I noticed that you defined certain versions for Heroku to run for node and npm, are those the same versions you are running locally? I have had luck in the past by setting these greater than or equal to the version I wanted:
"engines": {
"node": ">=14.17.4"
"npm": ">=6.14.14"
}

"Failed to load resource: net::ERR_CONNECTION_REFUSED" for assets, css, app.js and vendor.js in production (react, babel, webpack)

I am setting up a copy of steemit cllient from https://github.com/steemit/steemit.com.
everything works in development environment but when I try to run same in production following steps provided in github repo, it gives error in console : "Failed to load resource: net::ERR_CONNECTION_REFUSED"
I am unable to relate this issue to anything. I am relatively new to webpack. Any help will be appreciated.
fixed it by removing "content="upgrade-insecure-requests" from server-html.jsx so that i can test production on local. it's useful for production. if anyone wants to look into it, i found details here: https://googlechrome.github.io/samples/csp-upgrade-insecure-requests/

Got building snapshots error when deploy with Nodejitsu

I creat a simple Node.js app and deploy it by command "jitsu deploy" and got that error.
info: Creating snapshot 0.0.1-1
info: Uploading: [=============================] 100%
error: Error running command deploy
error: Error building snapshot
error: Nodejitsu Error (500): Internal Server Error
I don't know what to do with this, this's first time I try to use Nodejitsu
Please help!
You need to set node version as follows in you package.json file:
"node": "0.10.x"
OR
"node": "0.8.x"
Make sure you have .x at the end, it will not work if you set specific version, such as 0.10.29

ERROR: Procfile does not exist, and problems starting web processes

So, I'm currently following this tutorial: https://devcenter.heroku.com/articles/nodejs to start a simple Node.js app. I've got to the part where foreman is used to run the app locally (under Declaring process types with Procfile), and I'm getting an error telling me that the Procfile does not exist. My Procfile is in the same directory as my code, etc. All of the steps up till now have been fine. I skipped past this part in the tutorial to try and run the application on Heroku, but this line heroku ps:scale web=1 under Visit your application tells me that there is "No such type as web"... I'm using Windows to develop my app. Any help would be much appreciated. :-)
EDIT: web: node web.js is the contents of the Procfile, and I'm following the tutorial so I assume it's being committed... could you check the tutorial please and tell me if it is?
I had also received the Procfile does not exist error. The issue with mine was that I had left the '.txt' extension on the file. Once I removed the file extension and ran the foreman start it worked perfectly, hope this help =)

Resources