eventOneHQ/npm-audit-html

Powershell issues

nprail opened this issue · 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.

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 Interesting. What terminal are you using? Also, what Node version?

It's PowerShell running inside cmder.

λ node --version
v11.0.0

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).

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

npm audit --json > npm-audit-html

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

@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.

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'