Issue
I'm attempting to run a project called Streetmix in Debian 9. I have followed the install instructions to the best of my ability. So, when i use the NPM Start command (with or without sudo) in the streetmix folder I get:
> [email protected] prestart /home/dpowell/streetmix/streetmix
> npm run mongo:start
> [email protected] mongo:start /home/dpowell/streetmix/streetmix
> mongod --fork --logpath /dev/null
about to fork child process, waiting until server is ready for connections.
forked process: 2076
ERROR: child process failed, exited with error number 100
npm ERR! code ELIFECYCLE
npm ERR! errno 100
npm ERR! [email protected] mongo:start: `mongod --fork --logpath /dev/null`
npm ERR! Exit status 100
npm ERR!
npm ERR! Failed at the [email protected] mongo: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/2018-03-15T06_55_52_710Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 100
npm ERR! [email protected] prestart: `npm run mongo:start`
npm ERR! Exit status 100
npm ERR!
npm ERR! Failed at the [email protected] prestart 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/2018-03-15T06_55_52_721Z-debug.log
The instructions at Streetmix say that I needed to add the mongodb/bin folder to $PATH, but the command mongo --version works from any folder, which I take it to mean that since mongo is in the usr/bin folder that it's already in my $PATH, correct? (I've also started mongod and then Mongo shell to make sure that's working. I have also created the /data/db folders.
Does anyone have any insight into what my problem may be?
Here are the contents of the log mentioned at the end of the error:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 verbose lifecycle [email protected]~prestart: unsafe-perm in lifecycle true
7 verbose lifecycle [email protected]~prestart: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/dpowell/streetmix/streetmix/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
8 verbose lifecycle [email protected]~prestart: CWD: /home/dpowell/streetmix/streetmix
9 silly lifecycle [email protected]~prestart: Args: [ '-c', 'npm run mongo:start' ]
10 silly lifecycle [email protected]~prestart: Returned: code: 100 signal: null
11 info lifecycle [email protected]~prestart: Failed to exec prestart script
12 verbose stack Error: [email protected] prestart: `npm run mongo:start`
12 verbose stack Exit status 100
12 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
12 verbose stack at emitTwo (events.js:126:13)
12 verbose stack at EventEmitter.emit (events.js:214:7)
12 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
12 verbose stack at emitTwo (events.js:126:13)
12 verbose stack at ChildProcess.emit (events.js:214:7)
12 verbose stack at maybeClose (internal/child_process.js:925:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
13 verbose pkgid [email protected]
14 verbose cwd /home/dpowell/streetmix/streetmix
15 verbose Linux 4.9.0-6-amd64
16 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
17 verbose node v8.10.0
18 verbose npm v5.6.0
19 error code ELIFECYCLE
20 error errno 100
21 error [email protected] prestart: `npm run mongo:start`
21 error Exit status 100
22 error Failed at the [email protected] prestart script.
22 error This is probably not a problem with npm. There is likely additional logging output above.
23 verbose exit [ 100, true ]
Solution
The problem is with the --fork. I had the same problem.
What you need to do is remove the prestart and mongo:start script from package.json, open mongodb in a seperate terminal. Then you can run npm start as you normally do!
P.S. Make sure you don't commit this modified file
Answered By - Ayush Rawal