Skip to content

parse-server fails to start (parse-server: command not found) #4686

Closed

Description

@Edijae

I have followed the below commands to install parse server locally.

`$ npm install -g parse-server mongodb-runner
$ mongodb-runner start
$ parse-server --appId myserver --masterKey myserver --databaseURI mongodb://localhost/test

the server files are downloaded and stored at ~/.npm-global/lib/node_modules/parse-server$ when i go to that folder and try to run parse-server --appId myserver --masterKey myserver --databaseURI mongodb://localhost/test on the terminal, I get the error below

parse-server: command not found

When i try to run npm start on the terminal from the same folder, I get the error below

parse-server@2.7.4 start /home/user/.npm-global/lib/node_modules/parse-server
> node ./bin/parse-server

/home/user/.npm-global/lib/node_modules/parse-server/lib/ParseServer.js:124
    const {
          ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    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 Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/user/.npm-global/lib/node_modules/parse-server/lib/index.js:8:21)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

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

how can i run it?
Another thing, I had already installed mongodb and using it on my laptop. did 
```
$ npm install -g parse-server mongodb-runner
$ mongodb-runner start
```
install another mongo db?

Activity

  1. changed the title [-]parse-server fails to start[/-] [+]parse-server fails to start (parse-server: command not found)[/+] on Mar 30, 2018
  2. flovilmart commented on Mar 30, 2018

    @flovilmart
    Contributor

    Your node version (4.2.6) is outdated, you need to upgrade to a most recent version like 8.11.

  3. Edijae commented on Mar 30, 2018

    @Edijae
    Author

    @flovilmart did

    $ npm install -g parse-server mongodb-runner
    $ mongodb-runner start
    

    interfere with my other mongo db which i had installed by following instructions from mongodb.com?

  4. flovilmart commented on Mar 30, 2018

    @flovilmart
    Contributor

    The issue is not about mongodb, mongodb-runner is safe to use alongside your setup. You need to download and install the latest node version

  5. Edijae commented on Mar 30, 2018

    @Edijae
    Author

    I have updated node to v8.11.1 but when i try to run parse-server --appId "crusar" --masterKey "crusar" --databaseURI mongodb://localhost/test from the terminal or from inside ~/.npm-global/lib/node_modules/parse-server/ folder, i get the error parse-server: command not found and when i try to run npm start --appId "crusar" --masterKey "crusar" i get the error below

    module.js:549
        throw err;
        ^
    
    Error: Cannot find module '/home/user/.npm-global/lib/node_modules/parse-server/crusar'
        at Function.Module._resolveFilename (module.js:547:15)
        at Function.Module._load (module.js:474:25)
        at Module.require (module.js:596:17)
        at require (internal/module.js:11:18)
        at parseConfigFile (/home/user/.npm-global/lib/node_modules/parse-server/lib/cli/utils/commander.js:83:24)
        at Command._commander.Command.parse (/home/user/.npm-global/lib/node_modules/parse-server/lib/cli/utils/commander.js:121:20)
        at exports.default (/home/user/.npm-global/lib/node_modules/parse-server/lib/cli/utils/runner.js:20:23)
        at Object.<anonymous> (/home/user/.npm-global/lib/node_modules/parse-server/lib/cli/parse-server.js:48:22)
        at Module._compile (module.js:652:30)
        at Object.Module._extensions..js (module.js:663:10)
    
    
  6. flovilmart commented on Mar 30, 2018

    @flovilmart
    Contributor

    If you use npm start, your should add -- before the first parameter:

    npm start -- --appId ...

  7. Edijae commented on Mar 30, 2018

    @Edijae
    Author

    ooh my. that worked. so it means i have to enter parse-server folder(~/.npm-global/lib/node_modules/parse-server) and run the terminal from there. there is no way to do it directly without navigating to the folder. Isn't It?
    Another thing is why did parse-server --appId "crusar" --masterKey "crusar" --databaseURI mongodb://localhost/test command fail?

  8. flovilmart commented on Mar 30, 2018

    @flovilmart
    Contributor

    after you reinstalled node, you should probably run npm install -g parse-server then the parse-server command should be available.

  9. flovilmart commented on Mar 30, 2018

    @flovilmart
    Contributor

    if it isn,t it's probably because your PATH environment variable isn't properly configured.

  10. Edijae commented on Mar 31, 2018

    @Edijae
    Author

    @flovilmart Awesome.After I set my PATH variable at /etc/enviroment parse-server command worked.
    Thank you @flovilmart for your help. God bless you.

  11. Edijae commented on Apr 2, 2018

    @Edijae
    Author

    @flovilmart I tried to upload this parse-server to google app engine. First i created a file called app.yaml inside parse-server folder. It contained the following

    
    runtime: nodejs
    env: flex
    
    env_variables:
      # --REQUIRED--
      DATABASE_URI: "<my mongo db url>"
      APP_ID: "<my app id>"
      MASTER_KEY: "<my master key>"
      SERVER_URL: "<app engine server url>"
      # --OPTIONAL--
      # FILE_KEY: YOUR_FILE_KEY
      # PARSE_MOUNT: /parse
      # CLOUD_CODE_MAIN:
    

    when i run gcloud app deploy in the terminal, it is deployed to my app engine but not started for i get an npm error appId and masterKey are required. this error is printed in the terminal. It's like ~/.npm-global/lib/node_modules/parse-server/lib/cli/parse-server.js is being executed but the options parameter doesn't have appId and masterKey. When I try gcloud app deploy --appId "myId" --masterKey "my masterKey" it fails since the 2 options aren't part of gcloud. Where else can i set appId apart from app.yaml file? Kindly help

  12. Edijae commented on Apr 3, 2018

    @Edijae
    Author

    @flovilmart I deployed the server sample app instead of this and it worked.

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