我觉得我在这里做了一些非常愚蠢的事情,但我没有第二套眼睛方便。
describe('app.backend.src.server', () => {
const proxyquire = require('proxyquire');
const mach = require('mach.js'); // <- this is giving the error
it('should pass to make sure Im not crazy', () => {
expect(true).toBe(true);
});
});
我收到以下错误:
Failures:
1) app.backend.src.server encountered a declaration exception
1.1) SyntaxError: Unexpected token ...
的package.json
...
"devDependencies": {
"gulp": "^3.9.1",
"gulp-istanbul": "^1.1.1",
"gulp-jasmine": "^2.4.2",
"gulp-jshint": "^2.0.4",
"gulp-tap": "^0.1.3",
"jshint": "^2.9.4",
"mach.js": "^0.5.0",
"proxyquire": "^1.7.11",
"run-sequence": "^1.2.2"
}
...
有什么建议吗?
答案 0 :(得分:0)
听起来您可能正在使用不兼容的nodeJS版本。该错误消息似乎表明有问题的模块(mach)正在使用扩展运算符:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator
也许尝试将您的节点版本更新为支持spread运算符的版本。节点6+是一个不错的选择。这是一个很好的参考,可以保持最新的功能支持:
http://kangax.github.io/compat-table/es6/#test-spread_(...)_operator