How do I remove the PowerShell error dumps from my build log?

guw's Avatar

guw

09 Apr, 2018 02:09 PM

We have a Node/NPM build running. Whenever NPM fails, we do get tons of PowerShell error dumps printed to the build log.

Here is an example:

writeErrorStream      : True
PSMessageDetails      : 
Exception             : System.Management.Automation.RemoteException: npm ERR! A complete log of this run can be found in:
                        npm ERR!     C:\Users\appveyor\AppData\Roaming\npm-cache_logs\2018-04-09T12_27_25_603Z-debug.log


TargetObject : CategoryInfo : NotSpecified: (:) [], RemoteException FullyQualifiedErrorId : NativeCommandErrorMessage ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at <ScriptBlock>, <No file>: line 9 PipelineIterationInfo : {0, 0} writeErrorStream : True

Is there any way to turn this off? It duplicates a lot of the NPM output.

Update

I found the issue. We are executing NPM using a PowerShell script like this:

  - ps: |
      ...
      npm run test:without-system-tests
      $NpmTestsExitCode = $LastExitCode
      ...
      # Fail script in case of test failures
      if($NpmTestsExitCode -ne 0) {
        #$Error | Format-List * -Force
        exit $NpmTestsExitCode
      }

The problematic line is: $Error | Format-List * -Force. It seems to dump it to the console (AppVeyor build log). I removed that line and it's good now.

  1. Support Staff 1 Posted by Feodor Fitsner on 09 Apr, 2018 06:10 PM

    Feodor Fitsner's Avatar

    Try StdErr redirection as described here: https://stackoverflow.com/a/19550774/1435891

  2. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:28 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac