Skip to content

Unexpected Syntax Error Starting NPM Start #2836

Closed

Description

@spiderguy84

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

> [email protected] 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! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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

Activity

  1. mignev commented on Oct 6, 2016

    @mignev
    Contributor

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

  2. spiderguy84 commented on Oct 6, 2016

    @spiderguy84
    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:[email protected]: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);

    `

  3. mignev commented on Oct 6, 2016

    @mignev
    Contributor

    Yes ... just add , here:

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

    :)

  4. spiderguy84 commented on Oct 6, 2016

    @spiderguy84
    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

  5. mignev commented on Oct 6, 2016

    @mignev
    Contributor

    Okay :)

    Just write this in your terminal:

    export DATABASE_URI=mongodb://username:[email protected]:00000/fritchchurch
    

    and then:

    npm start
    

    :)

  6. spiderguy84 commented on Oct 6, 2016

    @spiderguy84
    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.

  7. mignev commented on Oct 6, 2016

    @mignev
    Contributor

    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 :)

  8. spiderguy84 commented on Oct 6, 2016

    @spiderguy84
    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

  9. mignev commented on Oct 6, 2016

    @mignev
    Contributor

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

  10. spiderguy84 commented on Oct 6, 2016

    @spiderguy84
    Author

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

  11. mignev commented on Oct 6, 2016

    @mignev
    Contributor

    :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions