DannyDainton / newman-reporter-htmlextra

A HTML reporter for Postman's Command Line Runner, Newman. Includes Non Aggregated Runs broken down by Iterations, Skipped Tests, Console Logs and the handlebars helpers module for better custom templates.
Apache License 2.0
357 stars 139 forks source link

Node js and HTML Reporter Installation issues #412

Closed ThePoojaChavan closed 1 year ago

ThePoojaChavan commented 1 year ago

Is There An Existing Issue

What Are You Seeing

HTML extra reporter issues with Nodejs installation

Steps To Reproduce The Issue

Installations and Versions on my computer
C:\>newman -v
5.3.2

C:\>node -v
v18.17.1

Getting stuck with:
When I install HTML reporter package with the command

npm install -g newman-reporter-htmlextra, I get the error

C:\Users\AppData\Roaming\npm\node_modules\npm\lib\cli.js:48

    throw err

    ^

Error: Cannot find module 'C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\signal-exit\dist\cjs\index.js'

    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1098:15)

    at finalizeEsmResolution (node:internal/modules/cjs/loader:1091:15)

    at resolveExports (node:internal/modules/cjs/loader:567:14)

    at Module._findPath (node:internal/modules/cjs/loader:636:31)

    at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)

    at Module._load (node:internal/modules/cjs/loader:922:27)

    at Module.require (node:internal/modules/cjs/loader:1143:19)

    at require (node:internal/modules/cjs/helpers:121:18)

    at Object.<anonymous> (C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\gauge\lib\index.js:5:14)

    at Module._compile (node:internal/modules/cjs/loader:1256:14) {

  code: 'MODULE_NOT_FOUND',

  path: 'C:\\Users\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\signal-exit\\package.json'

}

Full Newman Command Or Node Script

npm install -g newman-reporter-htmlextra

HTMLEXTRA Version

1.22.11

Newman Version

5.3.2

Additional Context

No response

github-actions[bot] commented 1 year ago

Hey @ThePoojaChavan: 👋 - Thanks for helping to make the reporter better by raising this ticket. I will take a look as soon as I can and get back to you. Cheers, Danny.

DannyDainton commented 1 year ago

Hey @ThePoojaChavan

Have you tried with an older version of node, you can switch between these suing something like nvm. I suspect that there is something in the reporter than is not currently compatible with version 18.

I would need to do a lot of testing to she what it might be so in the meantime, lowering the node version might unblock you.

ThePoojaChavan commented 1 year ago

Hi Danny, I just removed version 18 and installed an old version of node

C:>node -v v16.16.0

Same issue once again

DannyDainton commented 1 year ago

The only thing I can really say is to do a full uninstall, followed by an install.

npm uninstall -g newman newman-reporter-htmlextra

then

npm install -g newman newman-reporter-htmlextra

It's a tricky one to debug without being on your machine - There's roughly 170K downloads a week and this is the first time i've seen anyone mention an installation issue. I would have thought that would have been flagged by more people 🤔

ThePoojaChavan commented 1 year ago

Did a full uninstall and re-installed Danny, same issue.

Don't know how to solve this, maybe I would just go with CLI for the time being.

Thanks

DannyDainton commented 1 year ago

Are you able to install and use any of the other custom reporters for Newman?

ThePoojaChavan commented 1 year ago

Tried on Node v 16.16.0 , same issue for junit reporter as well

C:\>npm install -g newman-reporter-junitfull
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
C:\Users\AppData\Roaming\npm\node_modules\npm\lib\cli.js:48
    throw err
    ^

Error: Cannot find module 'C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\glob\dist\cjs\src\index.js'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:960:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:953:15)
    at resolveExports (node:internal/modules/cjs/loader:482:14)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\cacache\lib\util\glob.js:4:24)
    at Module._compile (node:internal/modules/cjs/loader:1105:14) {
  code: 'MODULE_NOT_FOUND',
  path: 'C:\\Users\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\glob\\package.json'
}
DannyDainton commented 1 year ago

That sounds like the issue is with your environment and the installation of node on your machine as it's not limited to only my reporter.

I would try and completely remove node from your machine and delete any node modules that you may have installed. Before trying everything again.

I'm going to close this issue as it isn't something specific to this reporter and I wouldn't be changing anything. Happy to talk more about this over on the Postman Community Forum.

ThePoojaChavan commented 1 year ago

Already removed all folders/ modules related to node, npm.

Re-installed nodejs v 16. Sadly, the issue is still there.

Thanks for your time and help Danny.

Regards

w4dd325 commented 1 year ago

Couple of things you could try...

The first thing I'd recommend is ensuring that you have opened CMD in Admin mode.


Make sure you are using the latest version of npm. Update npm using the following command: npm install -g npm@latest


Sometimes, issues can arise due to cached data. You can clear the npm cache using the following command: npm cache clean --force However, I have done this before and it caused me more issues... so I would probably recommend this as a last resort.

ThePoojaChavan commented 1 year ago

Hi James,

Opened cmd in Admin mode

C:\Windows\System32>node -v v16.16.0

C:\Windows\System32>npm -v npm WARN config global --global, --local are deprecated. Use --location=global instead. C:\Users\AppData\Roaming\npm\node_modules\npm\lib\cli.js:48 throw err ^

Error: Cannot find module 'C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\glob\dist\cjs\src\index.js' at createEsmNotFoundErr (node:internal/modules/cjs/loader:960:15) at finalizeEsmResolution (node:internal/modules/cjs/loader:953:15) at resolveExports (node:internal/modules/cjs/loader:482:14) at Function.Module._findPath (node:internal/modules/cjs/loader:522:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\cacache\lib\util\glob.js:4:24) at Module._compile (node:internal/modules/cjs/loader:1105:14) { code: 'MODULE_NOT_FOUND', path: 'C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\glob\package.json' }

C:\Windows\System32>npm install - g npm@latest npm WARN config global --global, --local are deprecated. Use --location=global instead. C:\User\AppData\Roaming\npm\node_modules\npm\lib\cli.js:48 throw err ^ Error: Cannot find module 'C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\glob\dist\cjs\src\index.js' at createEsmNotFoundErr (node:internal/modules/cjs/loader:960:15) at finalizeEsmResolution (node:internal/modules/cjs/loader:953:15) at resolveExports (node:internal/modules/cjs/loader:482:14) at Function.Module._findPath (node:internal/modules/cjs/loader:522:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\cacache\lib\util\glob.js:4:24) at Module._compile (node:internal/modules/cjs/loader:1105:14) { code: 'MODULE_NOT_FOUND', path: 'C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\glob\package.json' }

Same error for npm cache clean --force

w4dd325 commented 1 year ago

To be honest, it looks like an issue with Node... maybe try completely uninstalling Node.JS and then reinstall. Some info on uninstalling it here.

You could also try uninstalling NPM first then reinstalling npm uninstall -g npm npm install -g npm

You could also check your global install path npm config get prefix If it is wrong then update it using: npm config set prefix "C:\Users\\AppData\Roaming\npm"

ThePoojaChavan commented 1 year ago

Appreciate your reply, James.

I have uninstalled and completely removed all packages before re-installing lower node version.

npm uninstall -g npm gives same previous error message.

npm config get prefix also gives same error message.

Will it help if I attach cli.js, package.json and index.js?

w4dd325 commented 1 year ago

If 'npm config get prefix' doesn't work then I think this is very much an issue with your computer/environment. It sounds like your computer simply doesn't know where the NPM modules are stored.

Have you tried setting as I mentioned above? npm config set prefix "C:\Users<your-username>\AppData\Roaming\npm"

ThePoojaChavan commented 1 year ago

Just tried the setting npm config set prefix "C:\Users\AppData\Roaming\npm"

Same error.

w4dd325 commented 1 year ago

If this is a corporate machine I suggest you speak to your system administrators. If it's a personal machine, I'm not sure what else to suggest, but I think it is definitely your environment settings, not the reporter.

ThePoojaChavan commented 1 year ago

It's a personal machine.

I have checked PATH- system variables; just thinking aloud if it could be related to Windows 11. Other than that, I do not really know what else settings are causing the issue.

Thanks for all your help, appreciate it.

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.