【问题标题】:Unable to run node js seneca microservice无法运行 node js seneca 微服务
【发布时间】:2016-08-06 21:58:06
【问题描述】:

我是节点 js 的新手。我尝试使用 seneca 框架运行我的第一个节点微服务。但它显示以下错误

> npm ERR! Linux 4.2.0-16-generic
> 
> npm ERR! argv "/usr/local/bin/node" "/usr/bin/npm" "start"
> 
> npm ERR! node v5.10.1
> 
> npm ERR! npm  v3.8.6
> 
> npm ERR! code ELIFECYCLE
> 
> npm ERR! myproject@0.0.1 start: `node server.js`
> 
> npm ERR! Exit status 2
> 
> npm ERR! 
> 
> npm ERR! Failed at the myproject@0.0.1 start script 'node server.js'.
> 
> 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 myproject
> package,
> 
> npm ERR! not with npm itself.
> 
> npm ERR! Tell the author that this fails on your system:
> 
> npm ERR!     node server.js
> 
> npm ERR! You can get information on how to open an issue for this
> project with:
> 
> npm ERR!     npm bugs myproject
> 
> npm ERR! Or if that isn't available, you can get their info via:
> 
> npm ERR!     npm owner ls myproject
> 
> npm ERR! There is likely additional logging output above.
> 
> 
> npm ERR! Please include the following file with any support request:
> 
> npm ERR!     ~/Desktop/micro services/myproject/npm-debug.log

我使用 Seneca.js Yeoman 生成器来创建这个项目。请任何人帮助我。

我的项目目录如下结构

        test-seneca
        |
        |-- client
        |   |-- css
        |   |-- js
        |   |-- partials
        |   |-- index.html
        |-- server
        |   |-- api.js
        |-- test
        |   |-- functional
        |-- bower.json
        |-- package.json
        |-- server.js 

我的 package.json 是

{

  "name": "myproject",

  "version": "0.0.1",

  "scripts": {

    "postinstall": "./node_modules/.bin/webdriver-manager update --standalone && ./node_modules/.bin/bower install",

    "test": "./node_modules/.bin/protractor test/functional/protractor.conf.js"

  },

  "dependencies": 
{

 "async": "^0.9.0",

    "hapi": "~8.2.0",

    "hapi-seneca": "^1.0.3",

    "seneca": "git://github.com/rjrodger/seneca.git",

    "seneca-account": "^0.1.8",

    "seneca-auth": "git://github.com/rjrodger/seneca-auth.git",

    "seneca-card": "^0.1.3",

    "seneca-project": "^0.1.4",

    "seneca-user": "~0.2.10"

  },

  "devDependencies": {

    "protractor": "~1.7.0",

    "bower": "~1.3.12"

  }

}

【问题讨论】:

  • 你用来启动服务的命令是什么
  • npm start 运行服务器
  • 它启动了几次然后显示错误
  • 请包含package.json的内容
  • package.json 有以下内容

标签: node.js api microservices


【解决方案1】:

之所以失败,是因为yeoman生成器安装依赖失败,但是静默失败。

如果您查看package.json 内部,您可以看到seneca-authseneca 的依赖项指向不存在的repo。请更新这些,然后再次运行npm install

编辑

我建议你不要使用这个yeoman 生成器。它已经过时并且可能在您的节点版本上失败。

【讨论】:

  • 这是最好的方法。而不是约门。?我是节点 js 的新手
  • 但是还有一个问题 api 不工作。
  • 请先接受我的回答并创建另一个问题,因为它与当前问题无关
猜你喜欢
  • 2016-08-06
  • 1970-01-01
  • 1970-01-01
  • 2021-07-02
  • 1970-01-01
  • 2020-09-20
  • 1970-01-01
  • 2019-01-15
  • 2018-02-18
相关资源
最近更新 更多