npm-audit-html icon indicating copy to clipboard operation
npm-audit-html copied to clipboard

Powershell issues

Open nprail opened this issue 5 years ago • 8 comments

npm-audit-html doesn't seem to work in Powershell. Piping npm audit --json into npm-audit-html does not actually work. For some reason, there is no stdin. The process just silently exits.

Also, reading directly from a JSON files doesn't work in Powershell (e.g. npm audit --json > audit.json; npm-audit-html -i audit.json). The readJson function fails due to charector encoding issues.

nprail avatar Nov 11 '19 16:11 nprail

Seems to be working here, with PowerShell 5.1 (Windows 10 default): image

Also, reading directly from a JSON files doesn't work in Powershell

Yes, this really fails.

AdrianoCahete avatar Nov 17 '19 05:11 AdrianoCahete

@AdrianoCahete Interesting. What terminal are you using? Also, what Node version?

nprail avatar Nov 17 '19 14:11 nprail

It's PowerShell running inside cmder.

λ node --version
v11.0.0

AdrianoCahete avatar Nov 17 '19 22:11 AdrianoCahete

Interesting. I'm running the exact same build of Powershell as you so it must be the terminal emulator that is breaking it for me. I'm using Windows Terminal but I also tried the default terminal.

I'm running Node v12.13.0.

It looks like this is really two separate issues. I'll be digging into it when I have time (hopefully sometime before the end of the week).

nprail avatar Nov 20 '19 13:11 nprail

PowershelI is a special cookie! I just added “>” and it works.

npm audit --json > npm-audit-html

jonizen avatar Jun 09 '21 13:06 jonizen

@jonizen That seems to just write the JSON to a file named npm-audit-html for me.

nprail avatar Jun 09 '21 19:06 nprail

@jonizen That seems to just write the JSON to a file named npm-audit-html for me.

Same here 😢

Edit: The regular pipe command worked fine in the command prompt.

iPlexor avatar Jul 20 '21 08:07 iPlexor

PowerShell won't support piping output from one non-PowerShell command to another. You can still execute the cmd version of the command via PowerShell by passing it as a parameter to cmd.

cmd /c 'npm audit --json | npm-audit-html'

davidmdem avatar Nov 18 '21 18:11 davidmdem