parse-server无法启动

时间:2018-03-30 17:09:09

标签: javascript node.js mongodb parse-server

我已按照以下命令(https://github.com/parse-community/parse-server)在本地安装解析服务器。

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

将服务器文件下载并存储在~/.npm-global/lib/node_modules/parse-server。 当我尝试运行第3个命令 终端上的parse-server --appId myserver --masterKey myserver --databaseURI mongodb://localhost/test,我收到以下错误

parse-server: command not found

当我尝试从同一个文件夹在终端上运行npm start时,我收到以下错误

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.

我该怎么办呢? 另一件事,我已经安装了mongodb并在尝试在我的笔记本电脑上安装parse-server之前使用它。

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

在我的笔记本电脑上安装另一个mongo db?

1 个答案:

答案 0 :(得分:1)

我可以使用以下命令将//Fetch the title of the active tab console.log("-----------Button Clicked------------"); var activeTab = browser.tabs.query({active: true, currentWindow: true}); console.log("---------Printing type of variable \"activeTab\""); if (typeof activeTab == "undefined") console.log("The object is undefined") else console.log("The type of activeTab is:" + typeof activeTab) console.log("The title of activeTab is:") console.log(activeTab.title); 版本从nodejs更新为4.2.6来解决问题

8.11.1

之后,我添加了curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs 文件

的解析服务器路径
/etc/enviroment

附加了这一行sudo gedit /etc/enviroment 然后我运行:~/.npm-global/bin命令 并能够从终端启动parse-server

source /etc/enviroment