Jiew Meng
Jiew Meng

Reputation: 88189

Using NPM package (parse-server) from GitHub Master

I am trying to use the latest parse-server with some fixes in GitHub rather that NPM. However I find that when I

npm install --save ParsePlatform/parse-server

I get the error when I try to require parse-server

Error: Cannot find module 'parse-server'

Why is that? I notice also that in node_modules, parse-server/lib is empty. Did some compilation fail or something?

Upvotes: 1

Views: 233

Answers (1)

Joe Clay
Joe Clay

Reputation: 35787

Looking at the package.json in the Parse Server repo, they have a prepublish script that runs a build before pushing the files to NPM - this doesn't get run when pulling a package directly from Github, so you'll have to build it manually. If you go into the parse-server folder in your node_modules, open a command prompt, and run npm run build, it should make things work. You will have to do this every time you update the package, though!

EDIT: Upon further inspection, I noticed package.json has a files option set, making it so NPM ignores the src folder - this makes sense from their perspective, as it saves them having to push all the source code to NPM every time they do a new release, but it means that you're probably out of luck when it comes to installing from Github, as it's always going to leave out the files you need to be able to build it.

If you absolutely need the latest version of the code, I'd say your best option might be to clone the Github repo to your local machine, build it, then use npm link to link your project to the local version of the package. This will probably be a pain to maintain though - you're probably better off just sticking with the NPM version for now, and filing an issue on their Github asking them if they can make installing from the repo a possibility.

Upvotes: 1

Related Questions