Loading "grunt-karma.js" tasks...ERROR >> SyntaxError: Unexpected identifier
Loading "grunt-karma.js" tasks...ERROR >> SyntaxError: Unexpected identifier
加载 "grunt-karma.js" 个任务时出错。所有其他任务加载正常。
在更新了一些依赖项(包括 g运行t-karma 和 karma)后开始发现问题。
来自我的package.json:
"grunt-karma": "^3.0.2",
"karma": "^4.2.0",
我在 Gruntfile.js 中的 Karma 配置:
/**
* The Karma configurations.
*/
karma: {
options: {
configFile: '<%= build_dir %>/karma-unit.js'
},
unit: {
port: 9019,
background: true
},
continuous: {
singleRun: true
}
},
当我 运行 g运行t watch --verbose --debug 这是我看到的错误:
Registering "grunt-karma" local Npm module tasks.
Reading C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt-karma\package.json...OK
Parsing C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt-karma\package.json...OK
Loading "grunt-karma.js" tasks...ERROR
>> C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\karma\lib\server.js:117
>> async start () {
>> ^^^^^
>> SyntaxError: Unexpected identifier
>> at createScript (vm.js:56:10)
>> at Object.runInThisContext (vm.js:97:10)
>> at Module._compile (module.js:542:28)
>> at Object.Module._extensions..js (module.js:579:10)
>> at Module.load (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\coffeescript\lib\coffee-script\register.js:45:36)
>> at tryModuleLoad (module.js:446:12)
>> at Function.Module._load (module.js:438:3)
>> at Module.require (module.js:497:17)
>> at require (internal/module.js:20:19)
>> at Object.<anonymous> (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\karma\lib\index.js:4:16)
>> at Module._compile (module.js:570:32)
>> at Object.Module._extensions..js (module.js:579:10)
>> at Module.load (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\coffeescript\lib\coffee-script\register.js:45:36)
>> at tryModuleLoad (module.js:446:12)
>> at Function.Module._load (module.js:438:3)
>> at Module.require (module.js:497:17)
>> at require (internal/module.js:20:19)
>> at Object.<anonymous> (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt-karma\tasks\grunt-karma.js:9:30)
>> at Module._compile (module.js:570:32)
>> at Object.Module._extensions..js (module.js:579:10)
>> at Module.load (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\coffeescript\lib\coffee-script\register.js:45:36)
>> at tryModuleLoad (module.js:446:12)
>> at Function.Module._load (module.js:438:3)
>> at Module.require (module.js:497:17)
>> at require (internal/module.js:20:19)
>> at loadTask (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:313:10)
>> at C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:351:7
>> at Array.forEach (native)
>> at loadTasks (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:350:11)
>> at Task.task.loadNpmTasks (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:398:5)
>> at Object.module.exports (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\Gruntfile.js:17:11)
>> at loadTask (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:315:10)
>> at Task.task.init (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:434:5)
>> at Object.grunt.tasks (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt.js:111:8)
>> at Object.module.exports [as cli] (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\cli.js:27:9)
>> at Object.<anonymous> (C:\Users\pruane\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt:44:20)
>> at Module._compile (module.js:570:32)
>> at Object.Module._extensions..js (module.js:579:10)
>> at Module.load (module.js:487:32)
>> at tryModuleLoad (module.js:446:12)
>> at Function.Module._load (module.js:438:3)
>> at Module.runMain (module.js:604:10)
>> at run (bootstrap_node.js:389:7)
>> at startup (bootstrap_node.js:149:9)
>> at bootstrap_node.js:504:3
我将我的 karma 版本恢复到 3.1.4 并且不再看到问题:
"karma": "^3.1.4",
也尝试了 Karma 4.0.0 版,但错误仍然存在。
加载 "grunt-karma.js" 个任务时出错。所有其他任务加载正常。 在更新了一些依赖项(包括 g运行t-karma 和 karma)后开始发现问题。
来自我的package.json:
"grunt-karma": "^3.0.2", "karma": "^4.2.0",
我在 Gruntfile.js 中的 Karma 配置:
/**
* The Karma configurations.
*/
karma: {
options: {
configFile: '<%= build_dir %>/karma-unit.js'
},
unit: {
port: 9019,
background: true
},
continuous: {
singleRun: true
}
},
当我 运行 g运行t watch --verbose --debug 这是我看到的错误:
Registering "grunt-karma" local Npm module tasks.
Reading C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt-karma\package.json...OK
Parsing C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt-karma\package.json...OK
Loading "grunt-karma.js" tasks...ERROR
>> C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\karma\lib\server.js:117
>> async start () {
>> ^^^^^
>> SyntaxError: Unexpected identifier
>> at createScript (vm.js:56:10)
>> at Object.runInThisContext (vm.js:97:10)
>> at Module._compile (module.js:542:28)
>> at Object.Module._extensions..js (module.js:579:10)
>> at Module.load (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\coffeescript\lib\coffee-script\register.js:45:36)
>> at tryModuleLoad (module.js:446:12)
>> at Function.Module._load (module.js:438:3)
>> at Module.require (module.js:497:17)
>> at require (internal/module.js:20:19)
>> at Object.<anonymous> (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\karma\lib\index.js:4:16)
>> at Module._compile (module.js:570:32)
>> at Object.Module._extensions..js (module.js:579:10)
>> at Module.load (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\coffeescript\lib\coffee-script\register.js:45:36)
>> at tryModuleLoad (module.js:446:12)
>> at Function.Module._load (module.js:438:3)
>> at Module.require (module.js:497:17)
>> at require (internal/module.js:20:19)
>> at Object.<anonymous> (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt-karma\tasks\grunt-karma.js:9:30)
>> at Module._compile (module.js:570:32)
>> at Object.Module._extensions..js (module.js:579:10)
>> at Module.load (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\coffeescript\lib\coffee-script\register.js:45:36)
>> at tryModuleLoad (module.js:446:12)
>> at Function.Module._load (module.js:438:3)
>> at Module.require (module.js:497:17)
>> at require (internal/module.js:20:19)
>> at loadTask (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:313:10)
>> at C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:351:7
>> at Array.forEach (native)
>> at loadTasks (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:350:11)
>> at Task.task.loadNpmTasks (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:398:5)
>> at Object.module.exports (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\Gruntfile.js:17:11)
>> at loadTask (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:315:10)
>> at Task.task.init (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\task.js:434:5)
>> at Object.grunt.tasks (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt.js:111:8)
>> at Object.module.exports [as cli] (C:\Development\gitrepository\ContactCenterRepos\ccs-sdk\CCS_SDK\JavaScript\RefClient\node_modules\grunt\lib\grunt\cli.js:27:9)
>> at Object.<anonymous> (C:\Users\pruane\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt:44:20)
>> at Module._compile (module.js:570:32)
>> at Object.Module._extensions..js (module.js:579:10)
>> at Module.load (module.js:487:32)
>> at tryModuleLoad (module.js:446:12)
>> at Function.Module._load (module.js:438:3)
>> at Module.runMain (module.js:604:10)
>> at run (bootstrap_node.js:389:7)
>> at startup (bootstrap_node.js:149:9)
>> at bootstrap_node.js:504:3
我将我的 karma 版本恢复到 3.1.4 并且不再看到问题:
"karma": "^3.1.4",
也尝试了 Karma 4.0.0 版,但错误仍然存在。