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

Unexpected Syntax Error Starting NPM Start #2836

Closed
spiderguy84 opened this issue Oct 6, 2016 · 11 comments
Closed

Unexpected Syntax Error Starting NPM Start #2836

spiderguy84 opened this issue Oct 6, 2016 · 11 comments

Comments

@spiderguy84
Copy link

I am trying to migrate my parse data. I cloned the Server Example app, updated the url inside it with the mongodb address, and my master key, but I get this error with starting the nam

> parse-server-example@1.4.0 start /Users/candacebrassfield/Downloads/FritchParseMove
> node index.js

/Users/candacebrassfield/Downloads/FritchParseMove/index.js:19
  serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',  // Don't forget to change to https if needed
  ^^^^^^^^^
SyntaxError: Unexpected identifier
    at Object.exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:513:28)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:160:18)
    at node.js:456:3

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/6.2.1/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.2.1
npm ERR! nam  v3.9.3
npm ERR! code ELIFECYCLE
npm ERR! parse-server-example@1.4.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the parse-server-example@1.4.0 start script 'node index.js'.
npm ERR! Make sure you have the latest version of node.js and nam installed.
npm ERR! If you do, this is most likely a problem with the parse-server-example package,
npm ERR! not with nam itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs parse-server-example
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls parse-server-example
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/candacebrassfield/Downloads/FritchParseMove/npm-debug.log
@mignev
Copy link
Contributor

mignev commented Oct 6, 2016

Hi ... would you please provide your index.js file in gist or something. It's sounds like a syntax error :)

@spiderguy84
Copy link
Author

`// 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 path = require('path');

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

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

var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://username:password@ds000000.mlab.com:00000/fritchchurch',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'Fritch Church of Christ',
masterKey: process.env.MASTER_KEY || 'MASTERKEYHERE'
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
liveQuery: {
classNames: ["Users", "FritchDirectory"] // List of classes to support for query subscriptions
}
});
// 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 static assets from the /public folder
app.use('/public', express.static(path.join(__dirname, '/public')));

// 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 website. Please star the parse-server repo on GitHub!');
});

// There will be a test page available on the /test path of your server url
// Remove this before launching your app
app.get('/test', function(req, res) {
res.sendFile(path.join(__dirname, '/public/test.html'));
});

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

// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer);

`

@mignev
Copy link
Contributor

mignev commented Oct 6, 2016

Yes ... just add , here:

masterKey: process.env.MASTER_KEY || 'MASTERKEYHERE',

:)

@spiderguy84
Copy link
Author

Thanks. that fixed one error, but a new one presented itself.

DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.
info: Parse LiveQuery Server starts running

@mignev
Copy link
Contributor

mignev commented Oct 6, 2016

Okay :)

Just write this in your terminal:

export DATABASE_URI=mongodb://username:password@ds000000.mlab.com:00000/fritchchurch

and then:

npm start

:)

@spiderguy84
Copy link
Author

Thanks, that fixed it...now exactly what step would I now be on in migrating data? Do I run the curl POST command from here in same window that NPM is running on to test, or do I do that from somewhere else. The "simple" migration guide branches off in so many places at the beginning it's tough to keep straight.

@mignev
Copy link
Contributor

mignev commented Oct 6, 2016

Just use MongoChef for MongoDB (http://3t.io/) and export your data on your laptop and after that import it to your local MongoDB. I think will be the easiest way to do it :)

@spiderguy84
Copy link
Author

I already have the data migrated, and I see it in mLab in my Collections, it's all there. I just can't figure out what all to do from here, as the CURL command Parse says to use to test comes up with syntax errors as well for missing ; before statement

@mignev
Copy link
Contributor

mignev commented Oct 6, 2016

I can't get what are you trying to do :)

@spiderguy84
Copy link
Author

Sorry, let me create a new issue on here so we don't keep a thread going with unrelated stuff.

@mignev
Copy link
Contributor

mignev commented Oct 6, 2016

:)

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

3 participants