【发布时间】:2020-12-06 11:57:43
【问题描述】:
我是纽曼的新手。我导出了我的 collection.json 和 env.json,并试图与我的 CI\CD 管道(在本例中为 vsts)集成。 我有两个任务 - 安装 newman 然后运行测试。 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@5.1.2
os = ubuntu
我在这里错过了什么?
【问题讨论】:
-
集合文件名中的“-”看起来很可疑。也许这是一个错字?另外,我总是在文件名/路径周围加上引号。
标签: node.js ubuntu npm postman newman