当前位置 : 主页 > 网页制作 > Nodejs >

node.js – jasmine-node从命令提示符运行时显示错误

来源:互联网 收集:自由互联 发布时间:2021-06-16
使用这个安装的jasmine-node: sudo npm install jasmine-node -g 它成功并显示: /usr/bin/jasmine-node - /usr/lib/node_modules/jasmine-node/bin/jasmine-nodejasmine-node@1.14.3 /usr/lib/node_modules/jasmine-node├── underscor
使用这个安装的jasmine-node:

sudo npm install jasmine-node -g

它成功并显示:

/usr/bin/jasmine-node -> /usr/lib/node_modules/jasmine-node/bin/jasmine-node
jasmine-node@1.14.3 /usr/lib/node_modules/jasmine-node
├── underscore@1.6.0
├── mkdirp@0.3.5
├── walkdir@0.0.7
├── jasmine-reporters@2.0.0
├── coffee-script@1.7.1
├── requirejs@2.1.14
├── jasmine-growl-reporter@0.0.3 (growl@1.7.0)
└── gaze@0.3.4 (minimatch@0.2.14, fileset@0.1.5)

但是当我尝试运行这个:$jasmine-node spec /或jasmine-node时,它会显示如下错误:

/usr/lib/node_modules/jasmine-node/lib/jasmine-node/reporter.js:336
  jasmineNode.TeamcityReporter.prototype = new jasmine.TeamcityReporter;
                                           ^
TypeError: undefined is not a function
    at /usr/lib/node_modules/jasmine-node/lib/jasmine-node/reporter.js:336:44
    at Object.<anonymous> (/usr/lib/node_modules/jasmine-node/lib/jasmine-node/reporter.js:342:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/lib/node_modules/jasmine-node/lib/jasmine-node/index.js:34:21)
    at Module._compile (module.js:456:26)
该问题与jasmine-reporter模块的最新版本相关,jasmine-node依赖于该模块.在修复问题之前你可以做的一个可行的解决方法是降级jasmine-node的版本,它依赖于以前版本的jasmine-reporter.

sudo npm install jasmine-node@1.14.2 -g

当前版本是1.14.3,因此它落后于一个版本.

这个问题有一个漏洞:
https://github.com/larrymyers/jasmine-reporters/issues/63

网友评论