我正在尝试从jira服务器获取数据并需要在网页/控制台上显示该数据,但我在jira.get上遇到类型错误,如果有另一个jira api,我可以使用而不是这个很容易请让我知道
提前致谢
我的Nodejs代码在
之下-webkit-transform: rotate3d(-0.862, -0.744, 0, 22.7734933639967deg); transform: rotate3d(-0.862, -0.744, 0, 22.7734933639967deg); margin-left: -500px; margin-top: -500px; width: 1500px; height: 1500px; max-width: none; left: -179.902038574219px; top: -190.568115234375px;
答案 0 :(得分:1)
jira.issue.get
正在抛出TypeError
,因为jira.issue
未定义。这对Jira来说并不特别,可以这样证明:
$ node
> x = {};
{}
> x.a
undefined
> x.a.b()
TypeError: Cannot call method 'b' of undefined
at repl:1:6
at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:203:10)
at Interface._line (readline.js:532:8)
at Interface._ttyWrite (readline.js:761:14)
at ReadStream.onkeypress (readline.js:100:10)
at ReadStream.emit (events.js:98:17)
at emitKey (readline.js:1096:12)
从jira npm package开始,您需要实例化JiraApi&#39;类的实例,然后使用它来查找问题。从npm示例:
JiraApi = require('jira').JiraApi;
var jira = new JiraApi('https', config.host, config.port, config.user, config.password, '2.0.alpha1');
jira.findIssue(issueNumber, function(error, issue) {
console.log('Status: ' + issue.fields.status.name);
});