newman: could not find "htmlextra" reporter , using newman as library

29 Views Asked by At

I am trying to use newman as library to run my collections. I have added the same to package.json and i can see the same under my node_modules. The code works fine on my local. On my local there is no global installation for newman or newman-html-extra. But when i can deploy the same on a box and try to run the same it fails. with error :

newman: could not find "htmlextra" reporter ensure that the reporter is installed in the same directory as newman please install reporter using np

On the box , i can see the same present in package.json and also folder for newman and htmlextra report is created under node_modules. Can someone please help me understand what i am missing here. Node local version : v18.0.0 Node box version : v18.19.1

Code :

 const newman = require('newman');
  newman.run(
    {
      collection: JSON.parse(collectionFileData),
      environment: JSON.parse(envFileData),
      insecure: true,
      reporters: ['htmlextra'],
      reporter: {
        htmlextra: {
          export: resultFilePath,
        },
      },
    },
    async function (err) {
      if (err) {
        return {
          error: false,
          status: `We encounterd problem while running the collection : ${collectionFileName} Error message is : ${err} `,
          code: 500,
        };
      }


**[* node_modules]$ ls -lrt | grep newman
drwxr-xr-x  5 * *   119 Mar 21 07:05 newman-reporter-htmlextra
drwxr-xr-x  6 * *  4096 Mar 21 07:05 newman
0

There are 0 best solutions below