Parse-server: Parse 3.7.0 missing APN module

Created on 30 Jul 2019  路  29Comments  路  Source: parse-community/parse-server

Issue Description

After updating to ParseServer 3.7.0 (latest release), I can no longer start my server. It appears one of the modules (apn) for the @parse/push-adapter is missing. If I manually install the apn module, and start the parse-server, it works as usual. I do not use push-notifications in my setup, so I did not have the module installed previously.

Steps to reproduce

Update to ParseServer 3.7.0 and start the server.

Expected Results

Server should start as usual.

Actual Outcome

I receive the following error.

unhandledRejection error: { Error: Cannot find module 'apn' 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:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (/***/node_modules/@parse/push-adapter/lib/APNS.js:12:12) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787: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) code: 'MODULE_NOT_FOUND' }

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 3.7.0
    • Operating System: macOS Mojave 10.14.5
    • Hardware: MacBook Pro 2018
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): localhost
  • Database

    • MongoDB version: 3.6.12
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): localhost

All 29 comments

I think we didn't release this package correctly. I will try to publish a new release and fix it.

@johnnydimas as a temporary fix, you can do the following:

Clone parse-server-push-adapter repo, and run git checkout updateAPN && npm install && npm link.
And at the parse-server directory, npm install && npm link @parse/push-adapter.

It works for me :)

I did a clean npm install (removed node_modules and package-lock)

You can see it working https://github.com/parse-community/Parse-SDK-JS/pull/876

@dplewis I actually tried that as well before I posted the issue. It didn't seem to do the trick for me.

@johnnydimas could you please install parse-server from the master branch and check if the problem was solved for you? In a positive case, we will release a new version.

@davimacedo That did it for me, thanks for the assistance!

Nice. We will launch release 3.7.2 with the fix soon.

I just tried to do a fresh install of server 3.7.2 and am getting this error during npm install:

No matching version found for apn@^v3.0.2-parse

Tried deleting the package lock and modules dir and do a clean install, but no difference. Seems to be related to this issue, if you want I can create a new one though.

@Vortec4800 can you please share the steps that you are using to install parse-server 3.7.2 and also the versions of node.js and npm that you are using?

Sure. I've got these (along with other) frameworks in my package file:

"parse": "^2.6.0",
"parse-server": "^3.7.2",
"parse-server-mailgun-adapter-template": "^1.1.7",

Running Node 9.11.2 and npm 5.6.0

I could reproduce here. The problem is happening for node.js <= 9. Could you upgrade Node >= 10?

We ran into some compatibility issues with Node 10, so we decided to stick with 9. Is Parse server no longer supported in Node 9?

It seems that the problem is not the node version itself but the npm version, which is failing to install the package from the github tag. I tested here Node 9 with latest version of npm and it worked for me. Can you please try to upgrade npm and check again?

npm install -g npm@latest

I updated npm to 5.10 and that did the trick. Thank you!

I have the same problem with npm install parse-server, version latest: 3.7.2
(git is not installed on my test system)
NPM LOG

...
1 verbose cli   'install',
1 verbose cli   'parse-server' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session f8bccb23010efb78
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/parse-server 370ms
8 silly pacote tag manifest for parse-server@latest fetched in 400ms
...
101 silly fetchPackageMetaData error for apn@github:parse-community/node-apn#semver:^v3.0.2-parse Error while executing:
101 silly fetchPackageMetaData undefined ls-remote -h -t ssh://[email protected]/parse-community/node-apn.git
101 silly fetchPackageMetaData
101 silly fetchPackageMetaData
101 silly fetchPackageMetaData spawn git ENOENT
...
116 verbose Windows_NT 6.1.7601
117 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\laticq\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "parse-server"
118 verbose node v10.16.3
119 verbose npm  v6.10.3
120 error code ENOENT
121 error syscall spawn git
122 error path git
123 error errno ENOENT
124 error enoent Error while executing:
124 error enoent undefined ls-remote -h -t ssh://[email protected]/parse-community/node-apn.git
124 error enoent
124 error enoent
124 error enoent spawn git ENOENT
125 error enoent This is related to npm not being able to find a file.
126 verbose exit [ 1, true ]

I do not use the following features in my projects:

  • graphql
  • push
  • s3-files
  • redis

Are they required to install? Can I make the installation version without them or optionally?

Hi @laticq
This undefined ls-remote -h -t ssh://[email protected]/parse-community/node-apn.git means you don't have git installed. Check it using git --version and install it from here https://git-scm.com/download/win

Hi @laticq
This undefined ls-remote -h -t ssh://[email protected]/parse-community/node-apn.git means you don't have git installed. Check it using git --version and install it from here https://git-scm.com/download/win

Thank you, it worked. But earlier versions of parse-server could be installed without git, I would like to do without it...
Why did this start to happen?

@laticq It is because @funkenstrahlen made a fix to the node-apn repo but they have not made a new release so he and @davimacedo made the decision to point to our own fork of node-apn instead. This means it is no longer being installed from npm but directly from GitHub instead.

+1 I'm getting the same issue on parse-server 3.7.2 but only when on node lts-alpine 10.16.1 on docker. It works on non-alpine node 10.14.1 I'll see if I can dig a little deeper.

Edit:
In fact, it now appears that the error is thrown in Docker, regardless of whether I'm using alpine or regular node. This seems quite strange as I've been on 3.7.2 for almost a month, yet the issue only appeared for me when our container re-built early today.

Do you guys thing we should add the parse owned node-apn repository to npm to make deploys work without git installed?

We decided to create our own fork of node-apn because the existing repository is no longer actively maintained. With the fork we can fix required changes.

@omairvaiyani double check if your docker container has git installed. It is probably the issue.

@funkenstrahlen I agree with you. I think we can avoid all these issues by publishing our fork to npm. @acinader can you help us here?

@davimacedo what's the link to the fork?

@davimacedo
https://github.com/parse-community/node-apn/pull/5

I think those are the changes we need to create an @parse/node-apn package from your fork.

Awesome! Thank you @acinader 馃槉馃憤

New version was released. We should be fine now.

Was this page helpful?
0 / 5 - 0 ratings