Problems Deploying Node.js MEAN App to Heroku - node.js

My App is working locally, and is structured as follows:
MyApp
>package.json
>npm-debug.log
>readme.md
>client
>app
>node_modules
>public
>views
>bower.json
>Gruntfile.js
>package.json
>server
>config
>models
>node_modules
>routes
>app.js
>package.json
Deploying to heroku results in Application Error. The logs seem to indicate an issue with bcrypt dependency and with some Mongoose modules. Do I need to use something like MongoLabs for my app to work on Heroku? Also, I have some confusion about package.json and I'm not sure if I've implemented it properly. I have a package.json in my root directory and in my client directory and in my server directory.
package.json in root:
{
"name": "****",
"version": "1.0.0",
"description": "****",
"engines": {
"node": "4.4.7"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "cd server && node app.js"
},
"author": "*****",
"license": "ISC"
}
package.json in /server:
{
"name": "*****",
"version": "1.0.0",
"description": "******",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "******",
"license": "ISC",
"dependencies": {
"bcrypt": "^0.8.5",
"body-parser": "^1.13.2",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.3.5",
"ejs": "^2.3.3",
"express": "^4.13.1",
"express-session": "^1.11.3",
"mongoose": "^4.1.0",
"mongoskin": "^1.3.20",
"morgan": "^1.6.1",
"passport": "^0.2.2",
"passport-local": "^1.0.0"
}
}
and, package.json in /client:
{
"name": "****",
"version": "1.0.0",
"description": "******",
"main": "Gruntfile.js",
"directories": {
"test": "tests"
},
"dependencies": {
"grunt": "^0.4.5"
},
"devDependencies": {
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-watch": "^0.6.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}
heroku logs:
2016-07-31T23:12:37.522131+00:00 app[web.1]: ^
2016-07-31T23:12:37.522130+00:00 app[web.1]: throw e
2016-07-31T23:12:37.522133+00:00 app[web.1]: Error: /app/server/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header
2016-07-31T23:12:37.522132+00:00 app[web.1]:
2016-07-31T23:12:37.522134+00:00 app[web.1]: at Error (native)
2016-07-31T23:12:37.522136+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-07-31T23:12:37.522135+00:00 app[web.1]: at Object.Module._extensions..node (module.js:434:18)
2016-07-31T23:12:37.522136+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-07-31T23:12:37.522137+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-07-31T23:12:37.522138+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-07-31T23:12:37.522139+00:00 app[web.1]: at Object.<anonymous> (/app/server/node_modules/bcrypt/bcrypt.js:3:35)
2016-07-31T23:12:37.522139+00:00 app[web.1]: at bindings (/app/server/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
2016-07-31T23:12:37.522140+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-07-31T23:12:37.522140+00:00 app[web.1]: at Object.Module._extensions..js (module.js:416:10)
2016-07-31T23:12:37.522141+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-07-31T23:12:37.522142+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-07-31T23:12:37.522142+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-07-31T23:12:37.522143+00:00 app[web.1]: at Object.<anonymous> (/app/server/models/user.js:3:23)
2016-07-31T23:12:37.522143+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-07-31T23:12:37.522144+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-07-31T23:12:37.529768+00:00 app[web.1]:
2016-07-31T23:12:37.535942+00:00 app[web.1]: npm ERR! Linux 3.13.0-91-generic
2016-07-31T23:12:37.536334+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-07-31T23:12:37.536549+00:00 app[web.1]: npm ERR! node v4.4.7
2016-07-31T23:12:37.536950+00:00 app[web.1]: npm ERR! npm v2.15.8
2016-07-31T23:12:37.537269+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-07-31T23:12:37.537447+00:00 app[web.1]: npm ERR! ****#1.0.0 start: `cd server && npm install && node app.js`
2016-07-31T23:12:37.537605+00:00 app[web.1]: npm ERR! Exit status 1
2016-07-31T23:12:37.537772+00:00 app[web.1]: npm ERR!
2016-07-31T23:12:37.537933+00:00 app[web.1]: npm ERR! Failed at the ****#1.0.0 start script 'cd server && npm install && node app.js'.
2016-07-31T23:12:37.538132+00:00 app[web.1]: npm ERR! This is most likely a problem with the **** package,
2016-07-31T23:12:37.538291+00:00 app[web.1]: npm ERR! not with npm itself.
2016-07-31T23:12:37.538445+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-07-31T23:12:37.538601+00:00 app[web.1]: npm ERR! cd server && npm install && node app.js
2016-07-31T23:12:37.538768+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-07-31T23:12:37.538926+00:00 app[web.1]: npm ERR! npm bugs ****
2016-07-31T23:12:37.539078+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-07-31T23:12:37.539248+00:00 app[web.1]: npm ERR!
2016-07-31T23:12:37.539399+00:00 app[web.1]: npm ERR! npm owner ls ****
2016-07-31T23:12:37.539536+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-07-31T23:12:37.542846+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-07-31T23:12:37.542943+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-07-31T23:12:37.542671+00:00 app[web.1]:
2016-07-31T23:12:37.613094+00:00 heroku[web.1]: Process exited with status 1
2016-07-31T23:12:37.624890+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-31T23:13:53.875013+00:00 heroku[api]: Deploy 3be7c63 by ****#gmail.com
2016-07-31T23:13:53.875094+00:00 heroku[api]: Release v20 created by ****#gmail.com
2016-07-31T23:13:54.082054+00:00 heroku[slug-compiler]: Slug compilation started
2016-07-31T23:13:54.082063+00:00 heroku[slug-compiler]: Slug compilation finished
2016-07-31T23:13:54.206719+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-31T23:13:55.623943+00:00 heroku[web.1]: Starting process with command `npm start`
2016-07-31T23:13:57.804242+00:00 app[web.1]:
2016-07-31T23:13:57.804261+00:00 app[web.1]: > ****#1.0.0 start /app
2016-07-31T23:13:57.804262+00:00 app[web.1]: > cd server && node app.js
2016-07-31T23:13:57.804263+00:00 app[web.1]:
2016-07-31T23:13:58.379535+00:00 app[web.1]: throw e
2016-07-31T23:13:58.379536+00:00 app[web.1]: ^
2016-07-31T23:13:58.379520+00:00 app[web.1]: /app/server/node_modules/bcrypt/node_modules/bindings/bindings.js:83
2016-07-31T23:13:58.379542+00:00 app[web.1]: Error: /app/server/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header
2016-07-31T23:13:58.379544+00:00 app[web.1]: at Object.Module._extensions..node (module.js:434:18)
2016-07-31T23:13:58.379545+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-07-31T23:13:58.379537+00:00 app[web.1]:
2016-07-31T23:13:58.379543+00:00 app[web.1]: at Error (native)
2016-07-31T23:13:58.379547+00:00 app[web.1]: at bindings (/app/server/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
2016-07-31T23:13:58.379545+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-07-31T23:13:58.379548+00:00 app[web.1]: at Object.<anonymous> (/app/server/node_modules/bcrypt/bcrypt.js:3:35)
2016-07-31T23:13:58.379546+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-07-31T23:13:58.379546+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-07-31T23:13:58.379549+00:00 app[web.1]: at Object.Module._extensions..js (module.js:416:10)
2016-07-31T23:13:58.379548+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-07-31T23:13:58.379550+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-07-31T23:13:58.379549+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-07-31T23:13:58.379551+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-07-31T23:13:58.379551+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-07-31T23:13:58.387711+00:00 app[web.1]:
2016-07-31T23:13:58.393911+00:00 app[web.1]: npm ERR! Linux 3.13.0-91-generic
2016-07-31T23:13:58.394517+00:00 app[web.1]: npm ERR! node v4.4.7
2016-07-31T23:13:58.379552+00:00 app[web.1]: at Object.<anonymous> (/app/server/models/user.js:3:23)
2016-07-31T23:13:58.379552+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-07-31T23:13:58.394260+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-07-31T23:13:58.395240+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-07-31T23:13:58.395014+00:00 app[web.1]: npm ERR! npm v2.15.8
2016-07-31T23:13:58.395422+00:00 app[web.1]: npm ERR! ****#1.0.0 start: `cd server && node app.js`
2016-07-31T23:13:58.396100+00:00 app[web.1]: npm ERR! This is most likely a problem with the **** package,
2016-07-31T23:13:58.396258+00:00 app[web.1]: npm ERR! not with npm itself.
2016-07-31T23:13:58.396614+00:00 app[web.1]: npm ERR! cd server && node app.js
2016-07-31T23:13:58.395590+00:00 app[web.1]: npm ERR! Exit status 1
2016-07-31T23:13:58.395926+00:00 app[web.1]: npm ERR! Failed at the ****#1.0.0 start script 'cd server && node app.js'.
2016-07-31T23:13:58.395759+00:00 app[web.1]: npm ERR!
2016-07-31T23:13:58.396416+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-07-31T23:13:58.396937+00:00 app[web.1]: npm ERR! npm bugs ****
2016-07-31T23:13:58.396770+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-07-31T23:13:58.397098+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-07-31T23:13:58.400797+00:00 app[web.1]:
2016-07-31T23:13:58.401032+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-07-31T23:13:58.397260+00:00 app[web.1]: npm ERR!
2016-07-31T23:13:58.397418+00:00 app[web.1]: npm ERR! npm owner ls ****
2016-07-31T23:13:58.397584+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-07-31T23:13:58.401189+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-07-31T23:13:58.456892+00:00 heroku[web.1]: Process exited with status 1
2016-07-31T23:13:58.447070+00:00 heroku[web.1]: State changed from starting to crashed

Solved. Turned out to be a problem with bcrypt dependency. By .gitignore'ing my node_modules and installing dependencies on heroku server side, everything working now.

Related

What is going wrong with my MERN app deployment to Heroku?

I am trying to deploy a MERN app to Heroku and this is my error log and package.json file. Can anyone see what might be causing this? I am having trouble making sense of the logs.
2020-08-18T19:02:01.418730+00:00 app[web.1]: npm ERR! Failed at the mern-test#1.0.0 start:dev script.
2020-08-18T19:02:01.418905+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:01.460333+00:00 app[web.1]:
2020-08-18T19:02:01.465165+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:01.465345+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-18T19_02_01_448Z-debug.log
2020-08-18T19:02:01.513257+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:01.513666+00:00 app[web.1]: npm ERR! errno 1
2020-08-18T19:02:01.518773+00:00 app[web.1]: npm ERR! mern-test#1.0.0 start: `if-env NODE_ENV=production && npm run start:prod || npm run start:dev`
2020-08-18T19:02:01.518992+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-18T19:02:01.519232+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:01.519442+00:00 app[web.1]: npm ERR! Failed at the mern-test#1.0.0 start script.
2020-08-18T19:02:01.519639+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:01.548584+00:00 app[web.1]:
2020-08-18T19:02:01.548885+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:01.549093+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-18T19_02_01_529Z-debug.log
2020-08-18T19:02:01.616487+00:00 heroku[web.1]: Process exited with status 1
2020-08-18T19:02:01.665085+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-18T19:02:01.668346+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-18T19:02:12.552667+00:00 heroku[web.1]: Starting process with command `npm start`
2020-08-18T19:02:15.353294+00:00 app[web.1]:
2020-08-18T19:02:15.353325+00:00 app[web.1]: > mern-test#1.0.0 start /app
2020-08-18T19:02:15.353326+00:00 app[web.1]: > if-env NODE_ENV=production && npm run start:prod || npm run start:dev
2020-08-18T19:02:15.353326+00:00 app[web.1]:
2020-08-18T19:02:15.968345+00:00 app[web.1]:
2020-08-18T19:02:15.968361+00:00 app[web.1]: > mern-test#1.0.0 start:prod /app
2020-08-18T19:02:15.968361+00:00 app[web.1]: > node server.js
2020-08-18T19:02:15.968362+00:00 app[web.1]:
2020-08-18T19:02:16.998859+00:00 app[web.1]: internal/modules/cjs/loader.js:968
2020-08-18T19:02:16.998874+00:00 app[web.1]: throw err;
2020-08-18T19:02:16.998875+00:00 app[web.1]: ^
2020-08-18T19:02:16.998875+00:00 app[web.1]:
2020-08-18T19:02:16.998876+00:00 app[web.1]: Error: Cannot find module '../../controllers/theAudioDbController'
2020-08-18T19:02:16.998876+00:00 app[web.1]: Require stack:
2020-08-18T19:02:16.998877+00:00 app[web.1]: - /app/routes/api/index.js
2020-08-18T19:02:16.998877+00:00 app[web.1]: - /app/routes/index.js
2020-08-18T19:02:16.998877+00:00 app[web.1]: - /app/server.js
2020-08-18T19:02:16.998878+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
2020-08-18T19:02:16.998878+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:841:27)
2020-08-18T19:02:16.998879+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1025:19)
2020-08-18T19:02:16.998879+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-08-18T19:02:16.998880+00:00 app[web.1]: at Object.<anonymous> (/app/routes/api/index.js:2:30)
2020-08-18T19:02:16.998880+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1137:30)
2020-08-18T19:02:16.998880+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
2020-08-18T19:02:16.998881+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:985:32)
2020-08-18T19:02:16.998881+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:878:14)
2020-08-18T19:02:16.998881+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1025:19)
2020-08-18T19:02:16.998882+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-08-18T19:02:16.998882+00:00 app[web.1]: at Object.<anonymous> (/app/routes/index.js:3:19)
2020-08-18T19:02:16.998883+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1137:30)
2020-08-18T19:02:16.998883+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
2020-08-18T19:02:16.998884+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:985:32)
2020-08-18T19:02:16.998923+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:878:14) {
2020-08-18T19:02:16.998924+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-08-18T19:02:16.998925+00:00 app[web.1]: requireStack: [
2020-08-18T19:02:16.998925+00:00 app[web.1]: '/app/routes/api/index.js',
2020-08-18T19:02:16.998925+00:00 app[web.1]: '/app/routes/index.js',
2020-08-18T19:02:16.998926+00:00 app[web.1]: '/app/server.js'
2020-08-18T19:02:16.998926+00:00 app[web.1]: ]
2020-08-18T19:02:16.998927+00:00 app[web.1]: }
2020-08-18T19:02:17.021432+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:17.021861+00:00 app[web.1]: npm ERR! errno 1
2020-08-18T19:02:17.025837+00:00 app[web.1]: npm ERR! mern-test#1.0.0 start:prod: `node server.js`
2020-08-18T19:02:17.026037+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-18T19:02:17.026255+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:17.026335+00:00 app[web.1]: npm ERR! Failed at the mern-test#1.0.0 start:prod script.
2020-08-18T19:02:17.026396+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:17.033129+00:00 app[web.1]:
2020-08-18T19:02:17.033396+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:17.033590+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-18T19_02_17_028Z-debug.log
2020-08-18T19:02:17.588460+00:00 app[web.1]:
2020-08-18T19:02:17.588474+00:00 app[web.1]: > mern-test#1.0.0 start:dev /app
2020-08-18T19:02:17.588475+00:00 app[web.1]: > concurrently "nodemon --ignore 'client/*'" "npm run client"
2020-08-18T19:02:17.588476+00:00 app[web.1]:
2020-08-18T19:02:17.597996+00:00 app[web.1]: sh: 1: concurrently: not found
2020-08-18T19:02:17.617437+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:17.618167+00:00 app[web.1]: npm ERR! syscall spawn
2020-08-18T19:02:17.618426+00:00 app[web.1]: npm ERR! file sh
2020-08-18T19:02:17.618677+00:00 app[web.1]: npm ERR! errno ENOENT
2020-08-18T19:02:17.623336+00:00 app[web.1]: npm ERR! mern-test#1.0.0 start:dev: `concurrently "nodemon --ignore 'client/*'" "npm run client"`
2020-08-18T19:02:17.623493+00:00 app[web.1]: npm ERR! spawn ENOENT
2020-08-18T19:02:17.623658+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:17.623829+00:00 app[web.1]: npm ERR! Failed at the mern-test#1.0.0 start:dev script.
2020-08-18T19:02:17.623976+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:17.630596+00:00 app[web.1]:
2020-08-18T19:02:17.630799+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:17.630952+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-18T19_02_17_626Z-debug.log
2020-08-18T19:02:17.657848+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:17.658272+00:00 app[web.1]: npm ERR! errno 1
2020-08-18T19:02:17.663230+00:00 app[web.1]: npm ERR! mern-test#1.0.0 start: `if-env NODE_ENV=production && npm run start:prod || npm run start:dev`
2020-08-18T19:02:17.663456+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-18T19:02:17.663695+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:17.663882+00:00 app[web.1]: npm ERR! Failed at the mern-test#1.0.0 start script.
2020-08-18T19:02:17.664063+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:17.671333+00:00 app[web.1]:
2020-08-18T19:02:17.671650+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:17.671850+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-18T19_02_17_666Z-debug.log
2020-08-18T19:02:17.746107+00:00 heroku[web.1]: Process exited with status 1
2020-08-18T19:02:17.785792+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-18T19:02:20.046326+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=merntest.herokuapp.com request_id=ac795fc0-7677-4528-8f27-2f05a5f81912 fwd="99.9.203.7" dyno= connect= service= status=503 bytes= protocol=https
2020-08-18T19:02:21.701159+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=merntest.herokuapp.com request_id=288cf6cd-cff6-4943-9a89-b51bd0e8b8af fwd="99.9.203.7" dyno= connect= service= status=503 bytes= protocol=https
Here is my package.json file:
{
"name": "mern-test",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"start": "if-env NODE_ENV=production && npm run start:prod || npm run start:dev",
"start:prod": "node server.js",
"start:dev": "concurrently \"nodemon --ignore 'client/*'\" \"npm run client\"",
"client": "cd client && npm run start",
"install": "cd client && npm install",
"build": "cd client && npm run build",
"heroku-postbuild": "npm run install && npm run build "
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.19.2",
"bcryptjs": "^2.4.3",
"express": "^4.17.1",
"express-session": "^1.17.1",
"if-env": "^1.0.4",
"moment": "^2.27.0",
"mongoose": "^5.9.25",
"morgan": "^1.10.0",
"passport": "^0.4.1",
"passport-local": "^1.0.0",
"path": "^0.12.7",
"react-datepicker": "^3.1.3",
"react-router-dom": "^5.2.0",
"react-star-ratings": "^2.3.0",
"router": "^1.3.5"
},
"devDependencies": {
"concurrently": "^4.1.0",
"nodemon": "^2.0.4"
}
}
Please let me know if you see anything that is obviously wrong, or how I might continue to troubleshoot this. I am unsure of where to even start. Thank you.
As the Error says Error: Cannot find module '../../controllers/theAudioDbController'. Check if the file name is correct.

App not deploying with "start node.js" script

I'm trying to deploy a Discord bot with Google Cloud. Whenever I try to deploy using gcloud app deploy, I get this error:
> discord-bot#1.0.0 start /app
> node index.js
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'discord.js-commando'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/app/index.js:1:28)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! discord-bot#1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the discord-bot#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-12-09T05_48_58_649Z-debug.log
This is what my package.json looks like:
"name": "discord-bot",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
"dev": "nodemon index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^11.4.2",
"dotenv": "^7.0.0"
},
"devDependencies": {
"nodemon": "^1.18.11"
}
}
Any help would be greatly appreciated. Thank you!
try install the required package discord.js-commando. It's not in package.json. You can install it with npm install discord.js-commando --save

How to fix "babel: not found" and "Cannot find module './common' when deploying a MERN app to Heroku?

Trying to deploy a MERN stack app in Heroku and in the logs it mentions not finding Babel and a module './common'
I've already ran npm install before trying to deploy, I've removed all version 6 instances of Babel to upgrade to version 7 and I've reconfigured the build script as well to no avail.
Package.json - scripts:
"scripts": {
"start": "npm run build && node dist/index.js",
"serve": "node dist/index.js",
"build": "babel ./src/index.js -d dist",
"heroku-postbuild": "cd front-end && npm install --only=dev && npm install && npm run build"
},
Package.json - dependencies:
"dependencies": {
"#babel/cli": "^7.6.0",
"#babel/core": "^7.6.0",
"#babel/preset-env": "^7.6.0",
"#babel/register": "^7.6.0",
"#elastic/elasticsearch": "^7.2.0",
"aws-sdk": "^2.518.0",
"aws4": "^1.8.0",
"axios": "^0.19.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"cheerio": "^1.0.0-rc.3",
"common": "^0.2.5",
"connect-mongo": "^2.0.2",
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"dotenv": "^7.0.0",
"elasticsearch": "^16.3.0",
"express": "^4.16.3",
"express-session": "^1.15.6",
"express-validator": "^5.3.1",
"helmet": "^3.18.0",
"http-aws-es": "^6.0.0",
"install": "^0.13.0",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.11",
"mongoosastic": "^4.5.0",
"mongoose": "^5.3.4",
"morgan": "^1.9.1",
"multer": "^1.4.1",
"node-mailjet": "^3.3.1",
"node-pre-gyp": "^0.13.0",
"passport": "^0.4.0",
"passport-custom": "^1.0.5",
"passport-jwt": "^4.0.0",
"passport.socketio": "^3.7.0",
"request": "^2.88.0",
"request-promise": "^4.2.4",
"socket.io": "^2.2.0",
"socket.io-redis": "^5.2.0",
"stripe": "^6.25.1",
"swagger": "^0.7.5",
"swagger-ui-express": "^4.0.2",
"sync-request": "^6.1.0",
"validator": "^10.8.0",
"winston": "^3.1.0",
"xss": "^1.0.3"
},
"devDependencies": {
"nodemon": "^1.18.4"
}
Heroku Logs:
› Warning: heroku update available from 7.26.2 to 7.29.0.
2019-09-06T21:25:37.376275+00:00 app[web.1]: > paymentPlatform#0.3.0 build /app
2019-09-06T21:25:37.376282+00:00 app[web.1]: > babel ./src/index.js -d dist
2019-09-06T21:25:37.376284+00:00 app[web.1]:
2019-09-06T21:25:37.397001+00:00 app[web.1]: sh: 1: babel: not found
2019-09-06T21:25:37.404228+00:00 app[web.1]: npm ERR! file sh
2019-09-06T21:25:37.404233+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-09-06T21:25:37.404235+00:00 app[web.1]: npm ERR! errno ENOENT
2019-09-06T21:25:37.404238+00:00 app[web.1]: npm ERR! syscall spawn
2019-09-06T21:25:37.404242+00:00 app[web.1]: npm ERR! paymentPlatform#0.3.0 build: `babel ./src/index.js -d dist`
2019-09-06T21:25:37.404244+00:00 app[web.1]: npm ERR! spawn ENOENT
2019-09-06T21:25:37.404247+00:00 app[web.1]: npm ERR!
2019-09-06T21:25:37.407890+00:00 app[web.1]: npm ERR! Failed at the paymentPlatform#0.3.0 build script.
2019-09-06T21:25:37.408099+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-09-06T21:25:37.418872+00:00 app[web.1]:
2019-09-06T21:25:37.419240+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-09-06T21:25:37.419654+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-09-06T21_25_37_410Z-debug.log
2019-09-06T21:25:37.439598+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-09-06T21:25:37.439920+00:00 app[web.1]: npm ERR! errno 1
2019-09-06T21:25:37.441347+00:00 app[web.1]: npm ERR! paymentPlatform#0.3.0 start: `npm run build && node dist/index.js`
2019-09-06T21:25:37.441475+00:00 app[web.1]: npm ERR! Exit status 1
2019-09-06T21:25:37.441652+00:00 app[web.1]: npm ERR!
2019-09-06T21:25:37.441800+00:00 app[web.1]: npm ERR! Failed at the paymentPlatform#0.3.0 start script.
2019-09-06T21:25:37.441910+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-09-06T21:25:37.452916+00:00 app[web.1]:
2019-09-06T21:25:37.453949+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-09-06T21:25:37.455068+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-09-06T21_25_37_443Z-debug.log
2019-09-06T21:25:37.550220+00:00 heroku[web.1]: State changed from starting to crashed
2019-09-06T21:25:37.516263+00:00 heroku[web.1]: Process exited with status 1
2019-09-06T21:27:38.000000+00:00 app[api]: Build started by user ****.****#****.com
2019-09-06T21:31:22.176037+00:00 heroku[web.1]: State changed from crashed to starting
2019-09-06T21:31:22.014875+00:00 app[api]: Deploy 4dff7a9b by user ****.****#****.com
2019-09-06T21:31:22.014875+00:00 app[api]: Release v21 created by user ****.****#****.com
2019-09-06T21:31:29.000000+00:00 app[api]: Build succeeded
2019-09-06T21:31:52.195501+00:00 heroku[web.1]: Starting process with command `npm start`
2019-09-06T21:31:54.048390+00:00 app[web.1]:
2019-09-06T21:31:54.048412+00:00 app[web.1]: > paymentPlatform#0.3.0 start /app
2019-09-06T21:31:54.048414+00:00 app[web.1]: > npm run build && node dist/index.js
2019-09-06T21:31:54.048416+00:00 app[web.1]:
2019-09-06T21:31:54.590422+00:00 heroku[web.1]: State changed from starting to crashed
2019-09-06T21:31:54.367485+00:00 app[web.1]:
2019-09-06T21:31:54.367522+00:00 app[web.1]: > paymentPlatform#0.3.0 build /app
2019-09-06T21:31:54.367532+00:00 app[web.1]: > babel ./src/index.js -d dist
2019-09-06T21:31:54.367534+00:00 app[web.1]:
2019-09-06T21:31:54.481962+00:00 app[web.1]: internal/modules/cjs/loader.js:628
2019-09-06T21:31:54.481965+00:00 app[web.1]: throw err;
2019-09-06T21:31:54.481966+00:00 app[web.1]: ^
2019-09-06T21:31:54.481968+00:00 app[web.1]:
2019-09-06T21:31:54.481970+00:00 app[web.1]: Error: Cannot find module './common'
2019-09-06T21:31:54.481971+00:00 app[web.1]: Require stack:
2019-09-06T21:31:54.481974+00:00 app[web.1]: - /app/node_modules/debug/src/node.js
2019-09-06T21:31:54.481975+00:00 app[web.1]: - /app/node_modules/debug/src/index.js
2019-09-06T21:31:54.481977+00:00 app[web.1]: - /app/node_modules/#babel/core/lib/config/files/configuration.js
2019-09-06T21:31:54.481978+00:00 app[web.1]: - /app/node_modules/#babel/core/lib/config/files/index.js
2019-09-06T21:31:54.481980+00:00 app[web.1]: - /app/node_modules/#babel/core/lib/index.js
2019-09-06T21:31:54.481981+00:00 app[web.1]: - /app/node_modules/#babel/cli/lib/babel/options.js
2019-09-06T21:31:54.481983+00:00 app[web.1]: - /app/node_modules/#babel/cli/lib/babel/index.js
2019-09-06T21:31:54.481984+00:00 app[web.1]: - /app/node_modules/#babel/cli/bin/babel.js
2019-09-06T21:31:54.481986+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
2019-09-06T21:31:54.481987+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:527:27)
2019-09-06T21:31:54.481989+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:683:19)
2019-09-06T21:31:54.481990+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:16:16)
2019-09-06T21:31:54.481992+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/debug/src/node.js:236:18)
2019-09-06T21:31:54.481994+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2019-09-06T21:31:54.481995+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2019-09-06T21:31:54.481997+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:643:32)
2019-09-06T21:31:54.481998+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12)
2019-09-06T21:31:54.482000+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:683:19) {
2019-09-06T21:31:54.482001+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2019-09-06T21:31:54.482003+00:00 app[web.1]: requireStack: [
2019-09-06T21:31:54.482004+00:00 app[web.1]: '/app/node_modules/debug/src/node.js',
2019-09-06T21:31:54.482005+00:00 app[web.1]: '/app/node_modules/debug/src/index.js',
2019-09-06T21:31:54.482007+00:00 app[web.1]: '/app/node_modules/#babel/core/lib/config/files/configuration.js',
2019-09-06T21:31:54.482009+00:00 app[web.1]: '/app/node_modules/#babel/core/lib/config/files/index.js',
2019-09-06T21:31:54.482010+00:00 app[web.1]: '/app/node_modules/#babel/core/lib/index.js',
2019-09-06T21:31:54.482012+00:00 app[web.1]: '/app/node_modules/#babel/cli/lib/babel/options.js',
2019-09-06T21:31:54.482013+00:00 app[web.1]: '/app/node_modules/#babel/cli/lib/babel/index.js',
2019-09-06T21:31:54.482014+00:00 app[web.1]: '/app/node_modules/#babel/cli/bin/babel.js'
2019-09-06T21:31:54.482016+00:00 app[web.1]: ]
2019-09-06T21:31:54.482017+00:00 app[web.1]: }
2019-09-06T21:31:54.487548+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-09-06T21:31:54.487731+00:00 app[web.1]: npm ERR! errno 1
2019-09-06T21:31:54.488648+00:00 app[web.1]: npm ERR! paymentPlatform#0.3.0 build: `babel ./src/index.js -d dist`
2019-09-06T21:31:54.488743+00:00 app[web.1]: npm ERR! Exit status 1
2019-09-06T21:31:54.488862+00:00 app[web.1]: npm ERR!
2019-09-06T21:31:54.488954+00:00 app[web.1]: npm ERR! Failed at the paymentPlatform#0.3.0 build script.
2019-09-06T21:31:54.489097+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-09-06T21:31:54.496430+00:00 app[web.1]:
2019-09-06T21:31:54.496561+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-09-06T21:31:54.496627+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-09-06T21_31_54_490Z-debug.log
2019-09-06T21:31:54.503294+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-09-06T21:31:54.503506+00:00 app[web.1]: npm ERR! errno 1
2019-09-06T21:31:54.504677+00:00 app[web.1]: npm ERR! paymentPlatform#0.3.0 start: `npm run build && node dist/index.js`
2019-09-06T21:31:54.504826+00:00 app[web.1]: npm ERR! Exit status 1
2019-09-06T21:31:54.505007+00:00 app[web.1]: npm ERR!
2019-09-06T21:31:54.505170+00:00 app[web.1]: npm ERR! Failed at the paymentPlatform#0.3.0 start script.
2019-09-06T21:31:54.505327+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-09-06T21:31:54.511005+00:00 app[web.1]:
2019-09-06T21:31:54.511183+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-09-06T21:31:54.511305+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-09-06T21_31_54_506Z-debug.log
2019-09-06T21:31:54.562032+00:00 heroku[web.1]: Process exited with status 1

Understanding Heroku bcrypt errors in log when deploying Nodejs app

I am trying to deploy my node.js app to Heroku. It works perfectly fine locally, but when I try to deploy it I keep getting this:
2017-12-12T17:32:18.220591+00:00 app[web.1]: > ev#1.0.0 start /app
2017-12-12T17:32:18.220592+00:00 app[web.1]: > node app.js
2017-12-12T17:32:18.220592+00:00 app[web.1]:
2017-12-12T17:32:18.898850+00:00 heroku[web.1]: Process exited with status 1
2017-12-12T17:32:18.910740+00:00 heroku[web.1]: State changed from starting to crashed
2017-12-12T17:32:18.819322+00:00 app[web.1]: module.js:664
2017-12-12T17:32:18.819338+00:00 app[web.1]: return process.dlopen(module, path._makeLong(filename));
2017-12-12T17:32:18.819339+00:00 app[web.1]: ^
2017-12-12T17:32:18.819339+00:00 app[web.1]:
2017-12-12T17:32:18.819340+00:00 app[web.1]: Error: /app/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
2017-12-12T17:32:18.819341+00:00 app[web.1]: at Object.Module._extensions..node (module.js:664:18)
2017-12-12T17:32:18.819342+00:00 app[web.1]: at Module.load (module.js:554:32)
2017-12-12T17:32:18.819342+00:00 app[web.1]: at tryModuleLoad (module.js:497:12)
2017-12-12T17:32:18.819343+00:00 app[web.1]: at Function.Module._load (module.js:489:3)
2017-12-12T17:32:18.819343+00:00 app[web.1]: at Module.require (module.js:579:17)
2017-12-12T17:32:18.819344+00:00 app[web.1]: at require (internal/module.js:11:18)
2017-12-12T17:32:18.819344+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/bcrypt/bcrypt.js:6:16)
2017-12-12T17:32:18.819345+00:00 app[web.1]: at Module._compile (module.js:635:30)
2017-12-12T17:32:18.819345+00:00 app[web.1]: at Object.Module._extensions..js (module.js:646:10)
2017-12-12T17:32:18.819345+00:00 app[web.1]: at Module.load (module.js:554:32)
2017-12-12T17:32:18.819346+00:00 app[web.1]: at tryModuleLoad (module.js:497:12)
2017-12-12T17:32:18.819346+00:00 app[web.1]: at Function.Module._load (module.js:489:3)
2017-12-12T17:32:18.819346+00:00 app[web.1]: at Module.require (module.js:579:17)
2017-12-12T17:32:18.819347+00:00 app[web.1]: at require (internal/module.js:11:18)
2017-12-12T17:32:18.819347+00:00 app[web.1]: at Object.<anonymous> (/app/models/users.js:3:14)
2017-12-12T17:32:18.819347+00:00 app[web.1]: at Module._compile (module.js:635:30)
2017-12-12T17:32:18.827094+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-12-12T17:32:18.827465+00:00 app[web.1]: npm ERR! errno 1
2017-12-12T17:32:18.828807+00:00 app[web.1]: npm ERR! ev#1.0.0 start: `node app.js`
2017-12-12T17:32:18.828992+00:00 app[web.1]: npm ERR! Exit status 1
2017-12-12T17:32:18.829148+00:00 app[web.1]: npm ERR!
2017-12-12T17:32:18.829260+00:00 app[web.1]: npm ERR! Failed at the ev#1.0.0 start script.
2017-12-12T17:32:18.829357+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2017-12-12T17:32:18.834511+00:00 app[web.1]:
2017-12-12T17:32:18.834634+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-12-12T17:32:18.834782+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2017-12-12T17_32_18_830Z-debug.log
I have done npm install and npm install bcrypt again but the error persists. From my understanding of the log I think it is clear the error relates to bcrypt?
Here is my package.json file:
{
"name": "ev",
"version": "1.0.0",
"description": "search",
"main": "app.js",
"scripts": {
"start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"bcrypt": "^1.0.3",
"body-parser": "*",
"express": "*",
"jsonwebtoken": "^8.1.0",
"mongoose": "*"
},
"author": "My Name",
"license": "ISC"
You can use a pure JS version of bcrypt library.
Something like this
https://github.com/dcodeIO/bcrypt.js
This doesnt have any native dependency and should work perfectly.
We faced a lot difficulties in deploying apps with native dependencies to heroku and other cloud platform and we had to swap some of the libraries like bcrypt with pure js versions.

TypeError: Cannot read property 'length' of undefined in tsc.js

I have created a nodejs api project using typescript. But I am not able to start it. This is the command I am running
npm start
This is the output of this command
> project1#1.0.0 prestart D:\Workspace
> tsc
D:\Workspace\node_modules\typescript\lib\tsc.js:9921
for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) {
^
TypeError: Cannot read property 'length' of undefined
at Object.forEachChild (D:\Workspace\node_modules\typescript\lib\tsc.js:9921:70)
at setParentPointers (D:\Workspace\node_modules\typescript\lib\tsc.js:17392:12)
at D:\Workspace\node_modules\typescript\lib\tsc.js:17392:64
at visitNode (D:\Workspace\node_modules\typescript\lib\tsc.js:9533:24)
at Object.forEachChild (D:\Workspace\node_modules\typescript\lib\tsc.js:9918:25)
at setParentPointers (D:\Workspace\node_modules\typescript\lib\tsc.js:17392:12)
at D:\Workspace\node_modules\typescript\lib\tsc.js:17392:64
at visitNodes (D:\Workspace\node_modules\typescript\lib\tsc.js:9542:30)
at Object.forEachChild (D:\Workspace\node_modules\typescript\lib\tsc.js:9891:24)
at setParentPointers (D:\Workspace\node_modules\typescript\lib\tsc.js:17392:12)
at bindChildrenWorker (D:\Workspace\node_modules\typescript\lib\tsc.js:15178:25)
at bindChildren (D:\Workspace\node_modules\typescript\lib\tsc.js:15129:17)
at bindContainer (D:\Workspace\node_modules\typescript\lib\tsc.js:15122:17)
at bind (D:\Workspace\node_modules\typescript\lib\tsc.js:16214:21)
at Object.forEach (D:\Workspace\node_modules\typescript\lib\tsc.js:275:30)
at bindEach (D:\Workspace\node_modules\typescript\lib\tsc.js:15149:20)
at visitNodes (D:\Workspace\node_modules\typescript\lib\tsc.js:9538:24)
at Object.forEachChild (D:\Workspace\node_modules\typescript\lib\tsc.js:9707:24)
at bindEachChild (D:\Workspace\node_modules\typescript\lib\tsc.js:15165:16)
at bindChildrenWorker (D:\Workspace\node_modules\typescript\lib\tsc.js:15254:21)
at bindChildren (D:\Workspace\node_modules\typescript\lib\tsc.js:15129:17)
at bindContainer (D:\Workspace\node_modules\typescript\lib\tsc.js:15093:17)
at bind (D:\Workspace\node_modules\typescript\lib\tsc.js:16214:21)
at bindSourceFile (D:\Workspace\node_modules\typescript\lib\tsc.js:14851:17)
at Object.bindSourceFile (D:\Workspace\node_modules\typescript\lib\tsc.js:14809:9)
at initializeTypeChecker (D:\Workspace\node_modules\typescript\lib\tsc.js:36496:20)
at Object.createTypeChecker (D:\Workspace\node_modules\typescript\lib\tsc.js:18543:9)
at getDiagnosticsProducingTypeChecker (D:\Workspace\node_modules\typescript\lib\tsc.js:56042:93)
at Object.getGlobalDiagnostics (D:\Workspace\node_modules\typescript\lib\tsc.js:56370:53)
at compileProgram (D:\Workspace\node_modules\typescript\lib\tsc.js:59092:78)
at compile (D:\Workspace\node_modules\typescript\lib\tsc.js:59051:26)
at performCompilation (D:\Workspace\node_modules\typescript\lib\tsc.js:58940:33)
at Object.executeCommandLine (D:\Workspace\node_modules\typescript\lib\tsc.js:58883:9)
at Object.<anonymous> (D:\Workspace\node_modules\typescript\lib\tsc.js:59241:4)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\Workspace\node_modules\typescript\bin\tsc:2:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! project1#1.0.0 prestart: `tsc`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project1#1.0.0 prestart script 'tsc'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the project1 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tsc
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs project1
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls project1
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\Workspace\npm-debug.log
and my package.json
{
"name": "project1",
"version": "1.0.0",
"description": "Project 1",
"main": "index.js",
"scripts": {
"prestart": "tsc",
"start": "concurrently \"tsc --watch \" \"nodemon server.js startServer\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
"license": "ISC",
"dependencies": {
"#types/es6-promise": "0.0.32",
"body-parser": "^1.16.0",
"es6-map": "^0.1.5",
"giuseppe": "^1.2.0",
"make-runnable": "^1.0.7",
"request": "^2.79.0",
"request-promise": "^4.1.1",
"typescript": "^2.1.4"
},
"devDependencies": {
"#types/chai": "^3.4.34",
"concurrently": "^3.1.0",
"nodemon": "^1.11.0"
}
}
I have tried deleting node_modules folder and clearing cache using
npm cache clear
and then installing it again using
npm install
but fail to start? what could be the issue?
The issue was with typescript itself. Here is the issue raised on Github
https://github.com/Microsoft/TypeScript/issues/18301
but now the issue has been fixed.
Just update typescript module
npm update typescript --save

Resources