Npm start gives error when starting parse server

I installed npm modules. Installed node 12. But When I run npm start Parse server throws error and doesn’t start

I cloned parse-server-example with git clone. And I run Npm install on parse directory.

  let certificate = credentials.certificates[0];
TypeError: Cannot read property '0' of null
    at validateCredentials (/root/parse/node_modules/@parse/node-apn/lib/credentials/certificate/validate.js:4:45)
    at loadAndValidate (/root/parse/node_modules/@parse/node-apn/lib/credentials/certificate/prepare.js:20:5)
    at config (/root/parse/node_modules/@parse/node-apn/lib/config.js:49:22)
    at new Client (/root/parse/node_modules/@parse/node-apn/lib/client.js:21:19)
    at new Provider (/root/parse/node_modules/@parse/node-apn/lib/provider.js:12:19)
    at Function._createProvider (/root/parse/node_modules/@parse/push-adapter/lib/APNS.js:253:22)
    at new APNS (/root/parse/node_modules/@parse/push-adapter/lib/APNS.js:81:29)
    at new ParsePushAdapter (/root/parse/node_modules/@parse/push-adapter/lib/ParsePushAdapter.js:65:40)
    at loadAdapter (/root/parse/node_modules/parse-server/lib/Adapters/AdapterLoader.js:35:16)
    at loadAdapter (/root/parse/node_modules/parse-server/lib/Adapters/AdapterLoader.js:28:12)
npm ERR! errno 1
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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/2020-04-27T19_53_13_186Z-debug.log

This is the full log:

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 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/root/parse/node_modules/.bin:/usr/lo$
9 verbose lifecycle [email protected]~start: CWD: /root/parse
10 silly lifecycle [email protected]~start: Args: [ '-c', 'node index.js' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `node index.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:310:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:310:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /root/parse
16 verbose Linux 4.15.0-96-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v12.16.2
19 verbose npm  v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `node index.js`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Edit: I was using ubuntu 18.04. I switched to Cent Os 7 to see if this is os specific issue. But nope. Cent os also gave me exact same error.

15 days ago I Installed parse server with exact same steps. I didnt face this issue back then.

So problem was Push Adapter. When I remove Push adapter it started to work again.
Do you have any idea why did this happened? I have never faced this issue before.

I believe you did not configure any certificates for APN in config.json, can it be the case?

You are right. I didn’t configure that file. But I wasn’t configuring before either. And I have never faced this issue. Anyway I dont use parse server push system. I use firebase admin sdk. So I just removed it.

Probably some new check in the code in latest version of Parse Server. Glad it worked!