在ubuntu上运行newman时遇到语法错误

问题描述

我是纽曼的新手。我导出了collection.json和env.json并尝试与CI \ CD管道(在这种情况下为vsts)集成。 我有两个任务-安装newman然后运行测试。 纽曼安装工作正常,但运行测试的任务失败,并出现语法错误。

newman run Dev-.postman_collection.json -e Dev.postman_environment.json
 ========================== Starting Command Output ===========================
 [command]/bin/bash --noprofile --norc /vsts/agent/_work/_temp/5260102a-45bf-435f-814a-110329173b47.sh
 /usr/local/lib/node_modules/newman/bin/newman.js:7
     { Command } = require('commander'),^
 
 SyntaxError: Unexpected token {
     at exports.runInThisContext (vm.js:53:16)
     at Module._compile (module.js:374:25)
     at Object.Module._extensions..js (module.js:417:10)
     at Module.load (module.js:344:32)
     at Function.Module._load (module.js:301:12)
     at Function.Module.runMain (module.js:442:10)
     at startup (node.js:136:18)
     at node.js:966:3

安装步骤-

apt update
apt-get update
apt-get install nodejs
apt-get install npm
npm install -g newman

节点版本= v4.2.6

Newman版本= newman@5.1.2

os = Ubuntu

我在这里想念什么?

解决方法

问题出在节点版本上。我的ubuntu机器正在安装节点的旧版本。一旦获得v12。*,问题就解决了。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...