Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting syntax error while running newman on ubuntu

I am new to newman. I exported my collection.json and env.json and am trying to integrate with my CI\CD pipeline (vsts in this case). I have two taks - install newman & then run tests. Newman installation works fine but the task of running the test fails with syntax error.

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

Installation steps -

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

Node version = v4.2.6

Newman Version = [email protected]

os = ubuntu

What am I missing here ?

like image 665
Naxi Avatar asked Feb 15 '26 16:02

Naxi


1 Answers

The issue was with the node version. My ubuntu machine was installing an archaic version of node. Once I got v12.* , the issue got resolved.

like image 127
Naxi Avatar answered Feb 17 '26 05:02

Naxi