Node JS issue with hosting on Heroku 'Cannot find module' - node.js

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"
}

Related

Why cant heroku find my node modules when deploying?

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

Is it possible to have Heroku Local run like nodemon?

I'm new to Heroku, a little bit less to NodeJS (and Nodemon).
I am now using heroku local to run my app in local (and be as close as possible to my prod environment) but I'd like to have my app rebuilt and restarted everytime I make a change in local (as with Nodemon for example).
Is there nay way to do this with heroku local?
Thanks!
Nicolas.
Old question, I know, but came up while I was searching for the same. There is an answer here: https://stackoverflow.com/a/46561121
This is what I have in my package.json:
"scripts": {
"start": "nodemon --exec 'heroku local' --signal SIGTERM"
}
For anybody coming across this post in search of a solution. As mentioned by nicolasdaudin in response to tom, you can add nodemon to the heroku Procfile (https://devcenter.heroku.com/articles/procfile):
web: nodemon index.js
Note that nodemon must be installed globally for this to work:
npm i -g nodemon
Then you should be able to run heroku locally as normal with nodemon watching for changes:
heroku local web

Running blockchain-wallet-service on a Heroku worker

I'm trying to deploy my Django app on Heroku, that makes use of the Blockchain.info API V2 (https://github.com/blockchain/service-my-wallet-v3) and thus needs to run blockchain-wallet-service in the background, which in turn needs Node.js and npm installed.
On localhost, I have used this API successfully by running the service on my own machine, but I'm having trouble deploying to Heroku. Firstly, I assume I will need to run the service on a separate dyno, and that I will need node and npm installed on my instance.
Can someone tell me how to achieve this? I'm new to more advanced features of Heroku, I've tried to use the nodejs buildpack but I doubt this is the correct way. There is also this: https://elements.heroku.com/buttons/kmhouk/service-my-wallet-v3 which I've deployed as a separate app but I've failed to merge it in some way to my Django app.
Any help is much appreciated!
I had this exact same issue, bro, and i finally got some light in the end of the tunnel.
I've cloned the https://github.com/blockchain/service-my-wallet-v3 repository and deployed it to heroku and made some changes on "package.json" file. The problem is that (in heroku) you need to declare the dependencies on package file. I've added these lines:
"dependencies": {
"blockchain-wallet-service": "~0.22.4",
}
and a script to test in the deploy:
"scripts": {
"postinstall": "blockchain-wallet-service -V"
}
Also, by cloning this repository, i needed to add this line too:
"license" : "(ISC OR GPL-3.0)",
hope it works for you

lib-sass breaking harp on heroku

Interesting problem, Using harp to build a simple app, then deploying it to Heroku, which is proving to be an issue. The last deploy worked flawlessly using the Harp buildpack, But now it's breaking on deploy.
Nothing has changed that should be causing this, no updates to node modules, or node version. the logs and Papertrail are complaining:
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
After this, I branched off and tried to check on lib-sass in
/app/node_modules/harp/node_modules/terraform/node_modules/node-sass/lib/index.js:22
As per the logs, tried reinstalling it, but no avail. Anyone ever run into this? could it be a problem with the buildpack?
seems to be an issue with Node 0.12.
https://github.com/zeke/harp-buildpack/issues/12
I was able to get my app running by just not using the buildpack, adding
"dependencies": {
"harp": "~0.12.1"
},
"scripts": {
"start": "node server.js"
},
"engines": {
"node": "0.10.x"
},
to package.json and adding a server.js with
require('harp').server(__dirname, { port: process.env.PORT || 9000 })

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