Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not find the module "parse-server" #700

Closed
KunalKathrotia opened this issue Feb 27, 2016 · 5 comments
Closed

can not find the module "parse-server" #700

KunalKathrotia opened this issue Feb 27, 2016 · 5 comments

Comments

@KunalKathrotia
Copy link

Issue-429. @drew-gross Hi, That issue was concluded as future fix in 2.1.0, but even after using 2.1.3 i am facing the same issue. I am using the following index.js file.

// Example express application adding the parse-server module to expose Parse
// compatible API routes.

var express = require('express');
var ParseServer = require('parse-server').ParseServer;

var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI;

if (!databaseUri) {
  console.log('DATABASE_URI not specified, falling back to localhost.');
}

var api = new ParseServer({
  databaseURI: databaseUri || '<my_db_uri>',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || '<my_app_id>',
  masterKey: process.env.MASTER_KEY || '<my_master_key>', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'http://localhost:1337',  // Don't forget to change to https if needed
  fileKey: '<my_file_key>'
});
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
// If you wish you require them, you can set them as options in the initialization above:
// javascriptKey, restAPIKey, dotNetKey, clientKey

var app = express();

// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);

// Parse Server plays nicely with the rest of your web routes
app.get('/', function(req, res) {
  res.status(200).send('I dream of being a web site.');
});

var port = process.env.PORT || 1337;
app.listen(port, function() {
    console.log('parse-server-example running on port ' + port + '.');
});

And upon npm start i get the following error

Error: Cannot find module 'parse-server' at Function.Module._resolveFilename (module.js:326:15) at Function.Module._load (module.js:277:25) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object.<anonymous> (D:\RND\node\parse\parse-server\index.js:5:19) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Function.Module.runMain (module.js:442:10)

@omairvaiyani
Copy link
Contributor

Further info for this issue - I have had to fork the repo, clone it on my laptop, run npm install which then builds the repo properly, then I change .gitignore to remove lib from the excluded list. After pushing the changes, I now get the lib folder on my forked repo, which I then add to my server's package.json (instead of the original).

Can you help us understand why the repo must be built from src onto lib? I'm not familiar with this flow.

@drew-gross
Copy link
Contributor

We made some changes in how the library gets built in 2.1.3. I guess some issues snuck in. We'll make sure they are fixed in the next version.

@dozzman
Copy link

dozzman commented Mar 8, 2016

Any update on when we might see a fix?

I'm currently blocked by #852 but I can't seem to grab the #857 fix without going round the houses due to this problem.

Cheers.

@flovilmart
Copy link
Contributor

@dozzman all of those have been merged, we're at version 2.1.6 now.

If you wanna have parse-server running on master this is what I recommend:

## Assuming your project is initialized with a git repository
## and npm
# clone parse-server
git submodule add https://github.com/parseplatform/parse-server
# link parse-server to use the repo instead of the package
npm link parse-server ./parse-server
# commit and push
git add add -A
git commit -am 'Adds parse-server as submodule'
# if you're on heroku
git push heroku master

@KunalKathrotia
Copy link
Author

@flovilmart thanks a lot, it worked that way. I first did the check out of parse-server-example and than added parse-server from master branch as sub-module and linked it.

Sorry but i have to ask this as i am new to nodeJS and GIT and all, what i wanted to know is that i am using parse server directly from master branch in this parse-server-example. The current version of that parse-server is 2.2.0 in my repo, So how to update that repo using npm? Do i have to execute this npm install -g npm-check-updates from the root of parse-server-example ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants