shortenedURL - Problem deploying to heroku

My app works just fine locally but won’t deploy to heroku.

Any help would be greatly appreciated. There is a similar issue on the forum but involves mongodb. This is a bit outside the scope of FCC but if anyone has any experience with this issue, please help.

Error: Cannot find module ‘lodash/keys’

  • Something to do with the keys file, I suspect
  • keys is in root project directory/keys.js and it specified to be ignored by .gitignore file

I dont even use lodash in this app!!!

  • I installed and required lodash, lodash.keys, and mongodb just to see what it would do - nothing
    (im using mongoose and mLab and it works locally without installing mongodb)

Github Link

index.js

require('lodash');
require('lodash.keys');
require('mongodb');
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const path = require('path');
const mongoose = require('mongoose');
const { mongoURI } = require('./keys');
const routes = require('./routes/routes');

const app = express();
app.use(cors({ optionsSuccessStatus: 200 }));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(express.static('build'));
routes(app);

app.get('*', (req, res) => {
  res.sendFile(path.resolve(__dirname, 'build', 'index.html'));
});

mongoose.connect(mongoURI);
mongoose.connection
  .once('open', () => console.log('Connection Established'))
  .on('error', (error) => console.warn('Warning', error));

const PORT = process.env.PORT || 5000;
app.listen(PORT);

module.exports = app;

Heroku Logs

2018-07-26T23:33:21.714297+00:00 heroku[web.1]: Starting process with command `npm start`
2018-07-26T23:33:23.458305+00:00 app[web.1]: 
2018-07-26T23:33:23.458327+00:00 app[web.1]: > urlshortener@1.0.0 start /app
2018-07-26T23:33:23.458330+00:00 app[web.1]: > node index.js
2018-07-26T23:33:23.458331+00:00 app[web.1]: 
2018-07-26T23:33:24.736645+00:00 app[web.1]: module.js:549
2018-07-26T23:33:24.736684+00:00 app[web.1]: throw err;
2018-07-26T23:33:24.736686+00:00 app[web.1]: ^
2018-07-26T23:33:24.736688+00:00 app[web.1]: 
2018-07-26T23:33:24.736690+00:00 app[web.1]: Error: Cannot find module 'lodash/keys'
2018-07-26T23:33:24.736692+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:547:15)
2018-07-26T23:33:24.736694+00:00 app[web.1]: at Function.Module._load (module.js:474:25)
2018-07-26T23:33:24.736695+00:00 app[web.1]: at Module.require (module.js:596:17)
2018-07-26T23:33:24.736697+00:00 app[web.1]: at require (internal/module.js:11:18)
2018-07-26T23:33:24.736699+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/async/internal/iterator.js:16:13)
2018-07-26T23:33:24.736700+00:00 app[web.1]: at Module._compile (module.js:652:30)
2018-07-26T23:33:24.736703+00:00 app[web.1]: at Module.load (module.js:565:32)
2018-07-26T23:33:24.736702+00:00 app[web.1]: at Object.Module._extensions..js (module.js:663:10)
2018-07-26T23:33:24.736721+00:00 app[web.1]: at tryModuleLoad (module.js:505:12)
2018-07-26T23:33:24.736725+00:00 app[web.1]: at Module.require (module.js:596:17)
2018-07-26T23:33:24.736723+00:00 app[web.1]: at Function.Module._load (module.js:497:3)
2018-07-26T23:33:24.736726+00:00 app[web.1]: at require (internal/module.js:11:18)
2018-07-26T23:33:24.736728+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/async/internal/eachOfLimit.js:16:17)
2018-07-26T23:33:24.736730+00:00 app[web.1]: at Module._compile (module.js:652:30)
2018-07-26T23:33:24.736731+00:00 app[web.1]: at Object.Module._extensions..js (module.js:663:10)
2018-07-26T23:33:24.736733+00:00 app[web.1]: at Module.load (module.js:565:32)
2018-07-26T23:33:24.747275+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-07-26T23:33:24.747635+00:00 app[web.1]: npm ERR! errno 1
2018-07-26T23:33:24.748778+00:00 app[web.1]: npm ERR! urlshortener@1.0.0 start: `node index.js`
2018-07-26T23:33:24.748992+00:00 app[web.1]: npm ERR! Exit status 1
2018-07-26T23:33:24.749213+00:00 app[web.1]: npm ERR!
2018-07-26T23:33:24.749381+00:00 app[web.1]: npm ERR! Failed at the urlshortener@1.0.0 start script.
2018-07-26T23:33:24.749531+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-07-26T23:33:24.756250+00:00 app[web.1]: 
2018-07-26T23:33:24.756442+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-07-26T23:33:24.756593+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2018-07-26T23_33_24_750Z-debug.log
2018-07-26T23:33:24.829528+00:00 heroku[web.1]: State changed from starting to crashed
2018-07-26T23:33:24.813283+00:00 heroku[web.1]: Process exited with status 1
2018-07-26T23:33:25.378082+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fcc-urlshortener-rl.herokuapp.com request_id=e1a054ab-8307-4b24-a89b-724ef9641eae fwd="67.166.58.48" dyno= connect= service= status=503 bytes= protocol=https
2018-07-26T23:33:26.291642+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fcc-urlshortener-rl.herokuapp.com request_id=740bdd78-5a70-4fc5-a25f-9cfae89d1d09 fwd="67.166.58.48" dyno= connect= service= status=503 bytes= protocol=https