Deploying Vue app to Heroku, cannot find module shelljs - node.js

I am trying to deploy a vue template to our heroku instance. I have setup the procfile to call the right build script but am getting this.
Error: Cannot find module 'shelljs'
And the logs from it are:
2017-10-19T18:14:59.663986+00:00 heroku[web.1]: State changed from crashed to starting
2017-10-19T18:15:05.595940+00:00 heroku[web.1]: Starting process with command `npm run dev`
2017-10-19T18:15:13.354029+00:00 app[web.1]:
2017-10-19T18:15:13.354061+00:00 app[web.1]: > genesisui-vue#1.8.4 dev /app
2017-10-19T18:15:13.354061+00:00 app[web.1]: > node build/dev-server.js
2017-10-19T18:15:13.354062+00:00 app[web.1]:
2017-10-19T18:15:13.882843+00:00 app[web.1]: module.js:529
2017-10-19T18:15:13.882854+00:00 app[web.1]: throw err;
2017-10-19T18:15:13.882855+00:00 app[web.1]: ^
2017-10-19T18:15:13.882855+00:00 app[web.1]:
2017-10-19T18:15:13.882856+00:00 app[web.1]: Error: Cannot find module 'shelljs'
2017-10-19T18:15:13.882857+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:527:15)
2017-10-19T18:15:13.882858+00:00 app[web.1]: at Function.Module._load (module.js:476:23)
2017-10-19T18:15:13.882859+00:00 app[web.1]: at Module.require (module.js:568:17)
2017-10-19T18:15:13.882859+00:00 app[web.1]: at require (internal/module.js:11:18)
2017-10-19T18:15:13.882860+00:00 app[web.1]: at Object.<anonymous> (/app/build/check-versions.js:4:13)
2017-10-19T18:15:13.882860+00:00 app[web.1]: at Module._compile (module.js:624:30)
2017-10-19T18:15:13.882861+00:00 app[web.1]: at Object.Module._extensions..js (module.js:635:10)
2017-10-19T18:15:13.882861+00:00 app[web.1]: at Module.load (module.js:545:32)
2017-10-19T18:15:13.882862+00:00 app[web.1]: at tryModuleLoad (module.js:508:12)
2017-10-19T18:15:13.882863+00:00 app[web.1]: at Function.Module._load (module.js:500:3)
2017-10-19T18:15:13.894056+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-10-19T18:15:13.894488+00:00 app[web.1]: npm ERR! errno 1
2017-10-19T18:15:13.896140+00:00 app[web.1]: npm ERR! genesisui-vue#1.8.4 dev: `node build/dev-server.js`
2017-10-19T18:15:13.896314+00:00 app[web.1]: npm ERR! Exit status 1
2017-10-19T18:15:13.896580+00:00 app[web.1]: npm ERR!
2017-10-19T18:15:13.896777+00:00 app[web.1]: npm ERR! Failed at the genesisui-vue#1.8.4 dev script.
2017-10-19T18:15:13.896948+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2017-10-19T18:15:15.163061+00:00 app[web.1]:
2017-10-19T18:15:15.166845+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-10-19T18:15:15.166959+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2017-10-19T18_15_13_902Z-debug.log
2017-10-19T18:15:15.282631+00:00 heroku[web.1]: Process exited with status 1
2017-10-19T18:15:15.299772+00:00 heroku[web.1]: State changed from starting to crashed
Any leads would be very grateful!!!

npm install shelljs --save
git commit - m “your comment”
git push -u origin master
git push heroku master

Related

Heroku[router]: at=error code=H10 desc=”App crashed“ method=GET path=/favicon.ico”

I have a simple MERN APP, that works fine on localhost, but when I deploy it to Heroku I see a page with this error:
Application error An error occurred in the application and your page
could not be served. If you are the application owner, check your logs
for details. You can do this from the Heroku CLI with the command
heroku logs --tail
And the console is showing this: Failed to load resource: the server responded with a status of 503 (Service Unavailable)
An Image of that has also been attached!
And Heroku logs are also given below...
I'm new to MERN Dev, so can't really figure out what's the issue really is and Heroku logs are also not much of help, please help me!
Warning: heroku update available from 7.59.0 to 7.59.2.
2022-01-05T13:28:24.783142+00:00 app[web.1]:
2022-01-05T13:28:25.124488+00:00 app[web.1]: /app/node_modules/whatwg-url/lib/encoding.js:2
2022-01-05T13:28:25.124505+00:00 app[web.1]: const utf8Encoder = new TextEncoder();
2022-01-05T13:28:25.124505+00:00 app[web.1]: ^
2022-01-05T13:28:25.124506+00:00 app[web.1]:
2022-01-05T13:28:25.124507+00:00 app[web.1]: ReferenceError: TextEncoder is not defined
2022-01-05T13:28:25.124507+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/encoding.js:2:21)
2022-01-05T13:28:25.124508+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T13:28:25.124508+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2022-01-05T13:28:25.124509+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2022-01-05T13:28:25.124509+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2022-01-05T13:28:25.124509+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2022-01-05T13:28:25.124509+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:690:17)
2022-01-05T13:28:25.124510+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2022-01-05T13:28:25.124511+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/url-state-machine.js:5:34)
2022-01-05T13:28:25.124511+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T13:28:25.129285+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2022-01-05T13:28:25.129543+00:00 app[web.1]: npm ERR! errno 1
2022-01-05T13:28:25.130631+00:00 app[web.1]: npm ERR! server#1.0.0 start: `node server.js`
2022-01-05T13:28:25.130632+00:00 app[web.1]: npm ERR! Exit status 1
2022-01-05T13:28:25.130787+00:00 app[web.1]: npm ERR!
2022-01-05T13:28:25.130867+00:00 app[web.1]: npm ERR! Failed at the server#1.0.0 start script.
2022-01-05T13:28:25.130870+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2022-01-05T13:28:25.135681+00:00 app[web.1]:
2022-01-05T13:28:25.135782+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2022-01-05T13:28:25.135828+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2022-01-05T13_28_25_131Z-debug.log
2022-01-05T13:28:25.273876+00:00 heroku[web.1]: Process exited with status 1
2022-01-05T13:28:25.334794+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-05T14:58:18.000000+00:00 app[api]: Build started by user sauviksood#gmail.com
2022-01-05T14:59:12.408461+00:00 app[api]: Deploy 278ece53 by user sauviksood#gmail.com
2022-01-05T14:59:12.408461+00:00 app[api]: Release v6 created by user sauviksood#gmail.com
2022-01-05T14:59:13.000000+00:00 app[api]: Build succeeded
2022-01-05T14:59:13.762177+00:00 heroku[web.1]: State changed from crashed to starting
2022-01-05T14:59:19.381206+00:00 heroku[web.1]: Starting process with command `npm start`
2022-01-05T14:59:21.141420+00:00 app[web.1]:
2022-01-05T14:59:21.141434+00:00 app[web.1]: > server#1.0.0 start /app
2022-01-05T14:59:21.141435+00:00 app[web.1]: > node server.js
2022-01-05T14:59:21.141435+00:00 app[web.1]:
2022-01-05T14:59:21.365509+00:00 app[web.1]: /app/node_modules/whatwg-url/lib/encoding.js:2
2022-01-05T14:59:21.365511+00:00 app[web.1]: const utf8Encoder = new TextEncoder();
2022-01-05T14:59:21.365511+00:00 app[web.1]: ^
2022-01-05T14:59:21.365512+00:00 app[web.1]:
2022-01-05T14:59:21.365512+00:00 app[web.1]: ReferenceError: TextEncoder is not defined
2022-01-05T14:59:21.365512+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/encoding.js:2:21)
2022-01-05T14:59:21.365513+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T14:59:21.365513+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2022-01-05T14:59:21.365514+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2022-01-05T14:59:21.365514+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2022-01-05T14:59:21.365514+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2022-01-05T14:59:21.365514+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:690:17)
2022-01-05T14:59:21.365515+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2022-01-05T14:59:21.365516+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/url-state-machine.js:5:34)
2022-01-05T14:59:21.365518+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T14:59:21.370906+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2022-01-05T14:59:21.371167+00:00 app[web.1]: npm ERR! errno 1
2022-01-05T14:59:21.371985+00:00 app[web.1]: npm ERR! server#1.0.0 start: `node server.js`
2022-01-05T14:59:21.372041+00:00 app[web.1]: npm ERR! Exit status 1
2022-01-05T14:59:21.372158+00:00 app[web.1]: npm ERR!
2022-01-05T14:59:21.372219+00:00 app[web.1]: npm ERR! Failed at the server#1.0.0 start script.
2022-01-05T14:59:21.372273+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2022-01-05T14:59:21.375303+00:00 app[web.1]:
2022-01-05T14:59:21.375391+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2022-01-05T14:59:21.375436+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2022-01-05T14_59_21_373Z-debug.log
2022-01-05T14:59:21.529167+00:00 heroku[web.1]: Process exited with status 1
2022-01-05T14:59:21.611061+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-05T14:59:21.635160+00:00 heroku[web.1]: State changed from crashed to starting
2022-01-05T14:59:28.249204+00:00 heroku[web.1]: Starting process with command `npm start`
2022-01-05T14:59:29.604172+00:00 app[web.1]:
2022-01-05T14:59:29.604192+00:00 app[web.1]: > server#1.0.0 start /app
2022-01-05T14:59:29.604193+00:00 app[web.1]: > node server.js
2022-01-05T14:59:29.604193+00:00 app[web.1]:
2022-01-05T14:59:29.864349+00:00 app[web.1]: /app/node_modules/whatwg-url/lib/encoding.js:2
2022-01-05T14:59:29.864368+00:00 app[web.1]: const utf8Encoder = new TextEncoder();
2022-01-05T14:59:29.864369+00:00 app[web.1]: ^
2022-01-05T14:59:29.864369+00:00 app[web.1]:
2022-01-05T14:59:29.864370+00:00 app[web.1]: ReferenceError: TextEncoder is not defined
2022-01-05T14:59:29.864370+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/encoding.js:2:21)
2022-01-05T14:59:29.864370+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T14:59:29.864371+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2022-01-05T14:59:29.864371+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2022-01-05T14:59:29.864371+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2022-01-05T14:59:29.864371+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2022-01-05T14:59:29.864372+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:690:17)
2022-01-05T14:59:29.864372+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2022-01-05T14:59:29.864373+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/url-state-machine.js:5:34)
2022-01-05T14:59:29.864373+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T14:59:29.870542+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2022-01-05T14:59:29.870848+00:00 app[web.1]: npm ERR! errno 1
2022-01-05T14:59:29.871728+00:00 app[web.1]: npm ERR! server#1.0.0 start: `node server.js`
2022-01-05T14:59:29.871798+00:00 app[web.1]: npm ERR! Exit status 1
2022-01-05T14:59:29.871921+00:00 app[web.1]: npm ERR!
2022-01-05T14:59:29.871982+00:00 app[web.1]: npm ERR! Failed at the server#1.0.0 start script.
2022-01-05T14:59:29.872035+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2022-01-05T14:59:29.875332+00:00 app[web.1]:
2022-01-05T14:59:29.875429+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2022-01-05T14:59:29.875474+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2022-01-05T14_59_29_872Z-debug.log
2022-01-05T14:59:30.008365+00:00 heroku[web.1]: Process exited with status 1
2022-01-05T14:59:30.061904+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-05T14:59:31.128259+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=movie-watchlist-mern.herokuapp.com request_id=f86c07e6-1ee6-42c9-88be-3c7d1a60e53d fwd="103.155.240.47" dyno= connect= service= status=503 bytes= protocol=https
2022-01-05T14:59:34.147698+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=movie-watchlist-mern.herokuapp.com request_id=c0ccd4db-98b3-40fa-90c1-ad33cfe5a065 fwd="103.155.240.47" dyno= connect= service= status=503 bytes= protocol=https
Your heroku setup needs an update to the version 7.59.2
For this:
You have to run npm command if npm used for the heroku cli installation in you device,
npm:
npm upgrade -g heroku
Or if heroku was installed with yarn then,
yarn:
yarn global upgrade heroku
This may help your issue

heroku deploy vue app TypeError: Object prototype may only be an Object or null: /dist/

this issue is driving me nuts.
TypeError: Object prototype may only be an Object or null: /dist/
I think heroku is failing due to an issue with a static serving issue as I am using a single page vue app served up by an express server. I'm not sure what this error means though? it seems to be referencing app.use(express.static(__dirname, '/dist/')); but I don't know what argument to give it besides the path?
my express server.js is quite simple:
const express = require('express');
const app = express();
app.use(express.static(__dirname, '/dist/'));
app.get(/.*/, function(req, res){
res.sendfile(__dirname + "/dist/index.html")
})
const port = process.env.PORT || 5000;
app.listen(port);
here are some of my heroku logs detailing the problem
2020-06-09T07:47:19.000000+00:00 app[api]: Build started by user luthertester#gmail.com
2020-06-09T07:48:47.890090+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-09T07:48:47.712078+00:00 app[api]: Deploy d457ea7c by user luthertester#gmail.com
2020-06-09T07:48:47.712078+00:00 app[api]: Release v21 created by user luthertester#gmail.com
2020-06-09T07:48:55.749555+00:00 heroku[web.1]: Starting process with command `npm start`
2020-06-09T07:48:58.279945+00:00 heroku[web.1]: Process exited with status 1
2020-06-09T07:48:58.325770+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-09T07:48:58.027989+00:00 app[web.1]:
2020-06-09T07:48:58.028015+00:00 app[web.1]: > devdeepblog#0.1.0 start /app
2020-06-09T07:48:58.028016+00:00 app[web.1]: > node server.js
2020-06-09T07:48:58.028016+00:00 app[web.1]:
2020-06-09T07:48:58.213348+00:00 app[web.1]: /app/node_modules/serve-static/index.js:48
2020-06-09T07:48:58.213349+00:00 app[web.1]: var opts = Object.create(options || null)
2020-06-09T07:48:58.213350+00:00 app[web.1]: ^
2020-06-09T07:48:58.213350+00:00 app[web.1]:
2020-06-09T07:48:58.213351+00:00 app[web.1]: TypeError: Object prototype may only be an Object or null: /dist/
2020-06-09T07:48:58.213351+00:00 app[web.1]: at Function.create (<anonymous>)
2020-06-09T07:48:58.213352+00:00 app[web.1]: at Function.serveStatic [as static] (/app/node_modules/serve-static/index.js:48:21)
2020-06-09T07:48:58.213353+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:23)
2020-06-09T07:48:58.213353+00:00 app[web.1]: at Module._compile (module.js:652:30)
2020-06-09T07:48:58.213353+00:00 app[web.1]: at Object.Module._extensions..js (module.js:663:10)
2020-06-09T07:48:58.213354+00:00 app[web.1]: at Module.load (module.js:565:32)
2020-06-09T07:48:58.213354+00:00 app[web.1]: at tryModuleLoad (module.js:505:12)
2020-06-09T07:48:58.213354+00:00 app[web.1]: at Function.Module._load (module.js:497:3)
2020-06-09T07:48:58.213355+00:00 app[web.1]: at Function.Module.runMain (module.js:693:10)
2020-06-09T07:48:58.213355+00:00 app[web.1]: at startup (bootstrap_node.js:191:16)
2020-06-09T07:48:58.218237+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-06-09T07:48:58.218654+00:00 app[web.1]: npm ERR! errno 1
2020-06-09T07:48:58.219698+00:00 app[web.1]: npm ERR! devdeepblog#0.1.0 start: `node server.js`
2020-06-09T07:48:58.219855+00:00 app[web.1]: npm ERR! Exit status 1
2020-06-09T07:48:58.220093+00:00 app[web.1]: npm ERR!
2020-06-09T07:48:58.220259+00:00 app[web.1]: npm ERR! Failed at the devdeepblog#0.1.0 start script.
2020-06-09T07:48:58.220430+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-06-09T07:48:58.226320+00:00 app[web.1]:
2020-06-09T07:48:58.226466+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-06-09T07:48:58.226574+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-06-09T07_48_58_221Z-debug.log

Unable to push MERN App to heroku servers

So I have this MERN app pushed to my github repo https://github.com/Banialczele/coursemanagement and now I would like to push that repo to heroku.
My problem is that when ever I try to deploy my app to heroku server it deploys to server, but when I want to visit that link I got an error. However when I try to run heroku local web in my IDE my app runs perfectly, but when I want to deploy to server something is crushing all the time. This is what stacktrace looks like:
2020-03-14T12:25:20.748376+00:00 app[web.1]: [1] Error: Cannot find module 'express'
2020-03-14T12:25:20.748376+00:00 app[web.1]: [1] Require stack:
2020-03-14T12:25:20.748376+00:00 app[web.1]: [1] - /app/server/src/index.js
2020-03-14T12:25:20.748378+00:00 app[web.1]: [1] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
2020-03-14T12:25:20.748379+00:00 app[web.1]: [1] at Function.Module._load (internal/modules/cjs/loader.js:864:27)
2020-03-14T12:25:20.748379+00:00 app[web.1]: [1] at Module.require (internal/modules/cjs/loader.js:1044:19)
2020-03-14T12:25:20.748380+00:00 app[web.1]: [1] at require (internal/modules/cjs/helpers.js:77:18)
2020-03-14T12:25:20.748380+00:00 app[web.1]: [1] at Object.<anonymous> (/app/server/src/index.js:1:17)
2020-03-14T12:25:20.748380+00:00 app[web.1]: [1] at Module._compile (internal/modules/cjs/loader.js:1158:30)
2020-03-14T12:25:20.748380+00:00 app[web.1]: [1] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
2020-03-14T12:25:20.748381+00:00 app[web.1]: [1] at Module.load (internal/modules/cjs/loader.js:1002:32)
2020-03-14T12:25:20.748381+00:00 app[web.1]: [1] at Function.Module._load (internal/modules/cjs/loader.js:901:14)
2020-03-14T12:25:20.748381+00:00 app[web.1]: [1] at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
2020-03-14T12:25:20.748381+00:00 app[web.1]: [1] code: 'MODULE_NOT_FOUND',
2020-03-14T12:25:20.748382+00:00 app[web.1]: [1] requireStack: [ '/app/server/src/index.js' ]
2020-03-14T12:25:20.748382+00:00 app[web.1]: [1] }
2020-03-14T12:25:20.756503+00:00 app[web.1]: [1] npm ERR! code ELIFECYCLE
2020-03-14T12:25:20.756505+00:00 app[web.1]: [1] npm ERR! errno 1
2020-03-14T12:25:20.759707+00:00 app[web.1]: [1] npm ERR! teachercourseapp#1.0.0 server: `cd server/src && node index.js`
2020-03-14T12:25:20.760641+00:00 app[web.1]: [1] npm ERR! Exit status 1
2020-03-14T12:25:20.760642+00:00 app[web.1]: [1] npm ERR!
2020-03-14T12:25:20.760643+00:00 app[web.1]: [1] npm ERR! Failed at the teachercourseapp#1.0.0 server script.
2020-03-14T12:25:20.760644+00:00 app[web.1]: [1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-03-14T12:25:20.769172+00:00 app[web.1]: [1]
2020-03-14T12:25:20.771168+00:00 app[web.1]: [1] npm ERR! A complete log of this run can be found in:
2020-03-14T12:25:20.771169+00:00 app[web.1]: [1] npm ERR! /app/.npm/_logs/2020-03-14T12_25_20_761Z-debug.log
2020-03-14T12:25:20.779534+00:00 app[web.1]: [1] npm run server exited with code 1
2020-03-14T12:25:21.019553+00:00 app[web.1]: [0]
2020-03-14T12:25:21.019562+00:00 app[web.1]: [0] > coursemanagement#0.1.0 start /app/client
2020-03-14T12:25:21.019563+00:00 app[web.1]: [0] > react-scripts start
2020-03-14T12:25:21.019563+00:00 app[web.1]: [0]
2020-03-14T12:25:21.024669+00:00 app[web.1]: [0] sh: 1: react-scripts: not found
2020-03-14T12:25:21.029965+00:00 app[web.1]: [0] npm ERR! code ELIFECYCLE
2020-03-14T12:25:21.029966+00:00 app[web.1]: [0] npm ERR! syscall spawn
2020-03-14T12:25:21.030363+00:00 app[web.1]: npm ERR! file sh
2020-03-14T12:25:21.030364+00:00 app[web.1]: [0] npm ERR! errno ENOENT
2020-03-14T12:25:21.031948+00:00 app[web.1]: [0] npm ERR! coursemanagement#0.1.0 start: `react-scripts start`
2020-03-14T12:25:21.031949+00:00 app[web.1]: [0] npm ERR! spawn ENOENT
2020-03-14T12:25:21.031949+00:00 app[web.1]: [0] npm ERR!
2020-03-14T12:25:21.033375+00:00 app[web.1]: npm ERR! Failed at the coursemanagement#0.1.0 start script.
2020-03-14T12:25:21.033376+00:00 app[web.1]: [0] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-03-14T12:25:21.037820+00:00 app[web.1]: [0] npm WARN Local package.json exists, but node_modules missing, did you mean to install?
2020-03-14T12:25:21.038198+00:00 app[web.1]: [0]
2020-03-14T12:25:21.038591+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-03-14T12:25:21.038592+00:00 app[web.1]: [0] npm ERR! /app/.npm/_logs/2020-03-14T12_25_21_032Z-debug.log
2020-03-14T12:25:21.047517+00:00 app[web.1]: [0] npm ERR! code ELIFECYCLE
2020-03-14T12:25:21.047518+00:00 app[web.1]: [0] npm ERR! errno 1
2020-03-14T12:25:21.048896+00:00 app[web.1]: [0] npm ERR! teachercourseapp#1.0.0 client: `cd client/src && npm start`
2020-03-14T12:25:21.048897+00:00 app[web.1]: [0] npm ERR! Exit status 1
2020-03-14T12:25:21.048897+00:00 app[web.1]: [0] npm ERR!
2020-03-14T12:25:21.049322+00:00 app[web.1]: npm ERR! Failed at the teachercourseapp#1.0.0 client script.
2020-03-14T12:25:21.049753+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-03-14T12:25:21.055102+00:00 app[web.1]: [0]
2020-03-14T12:25:21.055708+00:00 app[web.1]: [0] npm ERR! A complete log of this run can be found in:
2020-03-14T12:25:21.055709+00:00 app[web.1]: [0] npm ERR! /app/.npm/_logs/2020-03-14T12_25_21_050Z-debug.log
2020-03-14T12:25:21.060294+00:00 app[web.1]: [0] npm run client exited with code 1
2020-03-14T12:25:21.067946+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-03-14T12:25:21.068281+00:00 app[web.1]: npm ERR! errno 1
2020-03-14T12:25:21.069285+00:00 app[web.1]: npm ERR! teachercourseapp#1.0.0 start: `concurrently "npm run client" "npm run server" `
2020-03-14T12:25:21.069440+00:00 app[web.1]: npm ERR! Exit status 1
2020-03-14T12:25:21.069684+00:00 app[web.1]: npm ERR!
2020-03-14T12:25:21.069864+00:00 app[web.1]: npm ERR! Failed at the teachercourseapp#1.0.0 start script.
2020-03-14T12:25:21.070045+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-03-14T12:25:21.075605+00:00 app[web.1]:
2020-03-14T12:25:21.075900+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-03-14T12:25:21.076095+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-03-14T12_25_21_070Z-debug.log
2020-03-14T12:25:21.194915+00:00 heroku[web.1]: State changed from starting to crashed
2020-03-14T12:25:21.175761+00:00 heroku[web.1]: Process exited with status 1
2020-03-14T12:25:22.079114+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=managingcourses.herokuapp.com request_id=175c1aa8-0966-4493-a328-ed303e4b8075 fwd="188.123.215.228
" dyno= connect= service= status=503 bytes= protocol=https
2020-03-14T12:25:22.577434+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=managingcourses.herokuapp.com request_id=912f071c-c6c0-49ce-996d-33005e324fb1 fwd="188.
123.215.228" dyno= connect= service= status=503 bytes= protocol=https
It starts with cannot find express module, but I've reinstalled it with --save flag and nothing changes. Could you please help me try to figure this out? I'm stack for like 2 days with that error.
Following the comment, I post where the problem is:
Heroku is looking at the package.json located at the root of your project. You installed express in the server folder but the file at the root does not contain it.
Either you can push a subtree of your repository:
git subtree push --prefix path/to/subdirectory heroku master
Or just split up your server and client parts into two repositories.

How do i change the port an heroku server runs on?

I just configured my server to support https with an SSL certificate and i'm getting this weird error in my heroku logs.
Error: listen EADDRINUSE: address already in use :::23736
2019-07-02T20:29:56.810153+00:00 app[web.1]: Error: listen EADDRINUSE: address already in use :::23736
2019-07-02T20:29:56.810155+00:00 app[web.1]: at Server.setupListenHandle [as _listen2] (net.js:1279:14)
2019-07-02T20:29:56.810157+00:00 app[web.1]: at listenInCluster (net.js:1327:12)
2019-07-02T20:29:56.810160+00:00 app[web.1]: at Server.listen (net.js:1414:7)
2019-07-02T20:29:56.810162+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:103:12)
2019-07-02T20:29:56.810163+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2019-07-02T20:29:56.810166+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2019-07-02T20:29:56.810168+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2019-07-02T20:29:56.810170+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2019-07-02T20:29:56.810171+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2019-07-02T20:29:56.810174+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
2019-07-02T20:29:56.810176+00:00 app[web.1]: Emitted 'error' event at:
2019-07-02T20:29:56.810178+00:00 app[web.1]: at emitErrorNT (net.js:1306:8)
2019-07-02T20:29:56.810180+00:00 app[web.1]: at process._tickCallback (internal/process/next_tick.js:63:19)
2019-07-02T20:29:56.810182+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
2019-07-02T20:29:56.810184+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-07-02T20:29:56.810186+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-07-02T20:29:56.819819+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-07-02T20:29:56.820414+00:00 app[web.1]: npm ERR! errno 1
2019-07-02T20:29:56.822143+00:00 app[web.1]: npm ERR! gbahdeyboh#1.0.0 start: `node server.js`
2019-07-02T20:29:56.822348+00:00 app[web.1]: npm ERR! Exit status 1
2019-07-02T20:29:56.822671+00:00 app[web.1]: npm ERR!
2019-07-02T20:29:56.822893+00:00 app[web.1]: npm ERR! Failed at the gbahdeyboh#1.0.0 start script.
2019-07-02T20:29:56.823098+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-07-02T20:29:56.829332+00:00 app[web.1]:
2019-07-02T20:29:56.829583+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-07-02T20:29:56.829738+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-07-02T20_29_56_825Z-debug.log
2019-07-02T20:29:56.895827+00:00 heroku[web.1]: State changed from starting to crashed
2019-07-02T20:29:56.902570+00:00 heroku[web.1]: State changed from crashed to starting
2019-07-02T20:29:56.878861+00:00 heroku[web.1]: Process exited with status 1
Is there a way to change what port heroku servers listen on?

Error: Cannot find module - Working locally but not on Heroku

I am running a node application that I cloned from my Heroku container. locally, it runs and the app operates from localhost:3000.
However when I deploy the app using git deploy to heroku, it starts and then immediately crashes. The heroku log is pasted below.
I can't work out why I am getting this error?
I've tried updating npm, deleteing node modules.
rm -rf node_modules
npm i core-util-is
npm install -g npm#latest
The heroku log looks like:
2019-06-24T15:35:26.071317+00:00 app[web.1]: > node index.js
2019-06-24T15:35:26.071318+00:00 app[web.1]:
2019-06-24T15:35:26.251019+00:00 app[web.1]: internal/modules/cjs/loader.js:638
2019-06-24T15:35:26.251023+00:00 app[web.1]: throw err;
2019-06-24T15:35:26.251024+00:00 app[web.1]: ^
2019-06-24T15:35:26.251026+00:00 app[web.1]:
2019-06-24T15:35:26.251027+00:00 app[web.1]: Error: Cannot find module './putty'
2019-06-24T15:35:26.251031+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
2019-06-24T15:35:26.251033+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:562:25)
2019-06-24T15:35:26.251034+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:690:17)
2019-06-24T15:35:26.251036+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2019-06-24T15:35:26.251037+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/sshpk/lib/formats/auto.js:18:13)
2019-06-24T15:35:26.251039+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2019-06-24T15:35:26.251040+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2019-06-24T15:35:26.251041+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2019-06-24T15:35:26.251043+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2019-06-24T15:35:26.251044+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2019-06-24T15:35:26.259163+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-06-24T15:35:26.259707+00:00 app[web.1]: npm ERR! errno 1
2019-06-24T15:35:26.261454+00:00 app[web.1]: npm ERR! hello#1.0.0 start: `node index.js`
2019-06-24T15:35:26.261645+00:00 app[web.1]: npm ERR! Exit status 1
2019-06-24T15:35:26.261955+00:00 app[web.1]: npm ERR!
2019-06-24T15:35:26.262153+00:00 app[web.1]: npm ERR! Failed at the hello#1.0.0 start script.
2019-06-24T15:35:26.262343+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-06-24T15:35:26.270567+00:00 app[web.1]:
2019-06-24T15:35:26.270795+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-06-24T15:35:26.270955+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-06-24T15_35_26_264Z-debug.log
I've deleted the package.json and node_modules and ran
npm init
then reinstalled the packages required, it now works.
I ran into this same issue and in my case was able to resolve by moving the alleged "missing" module from devDependencies to dependencies in package.json. For whatever reason, it didn't matter that it was saved in devDependencies locally but caused an error on Heroku until reinstalling as a regular dependency.

Resources