Azure-pipelines-tasks: Azure pipeline , error at npm install.

Created on 24 Jan 2019  路  13Comments  路  Source: microsoft/azure-pipelines-tasks

Azure DevOps Type and Version

I have below script

- job: Windows
  pool:
    vmImage: 'vs2017-win2016'
  steps:
  - task: DotNetCoreInstaller@0
    inputs:
      packageType: 'sdk' 
      version: '2.2.100' 

  - task: NodeTool@0
    inputs:
      versionSpec: '10.15.0' 
      #checkLatest: false # Optional

  - script: 'dotnet clean $(backendDirName)/server.sln'
    displayName: Server - Clean

  - script: 'dotnet build $(backendDirName)/server.sln'
    displayName: Server - Build

  - script: 'dotnet test $(backendDirName)'
    displayName: Server - Test

  - script: 'npm --prefix ./$(frontDirName) install ./$(frontDirName)'
    displayName: Client - installation

  - script: 'npm run build --prefix $(frontDirName)'
    displayName: Client - Build 

What's not working?

Please include error messages and screenshots.

I get error at point of Npm install !!!

The error is

`` 2019-01-24T08:25:15.5876529Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): 2019-01-24T08:25:15.5876999Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) 2019-01-24T08:25:15.5878377Z 2019-01-24T08:25:15.5913825Z npm ERR! code ELIFECYCLE 2019-01-24T08:25:15.5918430Z npm ERR! errno 1 2019-01-24T08:25:15.5921796Z npm ERR! [email protected] postinstall:opencollective postinstall`
2019-01-24T08:25:15.5922341Z npm ERR! Exit status 1
2019-01-24T08:25:15.5923633Z npm ERR!
2019-01-24T08:25:15.5923947Z npm ERR! Failed at the [email protected] postinstall script.
2019-01-24T08:25:15.5924162Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-01-24T08:25:15.6774873Z
2019-01-24T08:25:15.6775578Z npm ERR! A complete log of this run can be found in:
2019-01-24T08:25:15.6775812Z npm ERR! C:\npm\cache_logs\2019-01-24T08_25_15_607Z-debug.

ArtifactsPackages

Most helpful comment

@arashbahreini add the following to your yaml file and queue another build

  - task: PublishBuildArtifacts@1
    displayName: Publish log
    condition: always()
    inputs:
      pathToPublish: "C:\npm\cache\_logs"
      artifactName: log
      artifactType: container

All 13 comments

@arashbahreini i don't think this is a problem with the agent itself, the agent run the script task and wait for STDOUT/STDERR/ExitCode. the task invoke npm.exe and base on npm's return code to failed the step.
you might want to add an always run step to upload log file from C:\npm\cache\_logs to debug this problem further.

@TingluoHuang Please tell me how can I access to log file ?

@arashbahreini add the following to your yaml file and queue another build

  - task: PublishBuildArtifacts@1
    displayName: Publish log
    condition: always()
    inputs:
      pathToPublish: "C:\npm\cache\_logs"
      artifactName: log
      artifactType: container

@TingluoHuang Thanks for your response and your time.
I am new to DevOps and pipelines. with your command I got below error.

2019-01-24T22:07:47.3495601Z ##[error]Publishing build artifacts failed with an error: Not found PathtoPublish: C:\npm\cache\_logs

I am confuse that C:\npm\cache\_logs is path of which machine? Will this path generate in my PC or Azure vm ? If answer is Azure vm, how can I get access to it ?

Thanks again.

@arashbahreini it's from the build machine, the hosted Azure VM.
however you can't access the machine after your build finish, since the machine will get recycle for every customer build.

@TingluoHuang So how can I see my generated log file ? and how can I run out of Not found PathtoPublish: C:\npm\cache\_logs error ?

@arashbahreini what's your yaml file looks like now? are you able to run the same command successfully on your local box?

Yes, My commands will run successful on linux and mac. the only problem is with windows. I am wondering that I am running the same command on windows and linux but windows cannot run npm install !!!!

My full YAML file is

trigger:
- master

variables:
  backendDirName: 'server'
  frontDirName: 'client'

jobs:
- job: Linux
  pool:
    vmImage: 'ubuntu-16.04'
  strategy:
    maxParallel: 2    
    matrix:
      Debug:
        configuration: debug
      Release:
        configuration: release
  steps:
  - task: DotNetCoreInstaller@0
    inputs:
      packageType: 'sdk' 
      version: '2.2.100' 

  - script: 'dotnet clean $(backendDirName)/server.sln'
    displayName: Server - Clean

  - script: 'dotnet build $(backendDirName)/server.sln'
    displayName: Server - Build

  - script: 'dotnet test $(backendDirName)'
    displayName: Server - Test

  - script: 'npm --prefix ./$(frontDirName) install ./$(frontDirName)'
    displayName: Client - installation

  - script: 'npm run build --prefix $(frontDirName)'
    displayName: Client - Build        

- job: Windows
  pool:
    vmImage: 'vs2017-win2016'
  strategy:
    maxParallel: 2    
    matrix:
      Debug:
        configuration: debug
      Release:
        configuration: release    
  steps:
  - task: DotNetCoreInstaller@0
    inputs:
      packageType: 'sdk' 
      version: '2.2.100' 

  - task: NodeTool@0
    inputs:
      versionSpec: '11.7.0' 
      #checkLatest: false # Optional

  - script: 'dotnet clean $(backendDirName)/server.sln'
    displayName: Server - Clean

  - script: 'dotnet build $(backendDirName)/server.sln'
    displayName: Server - Build

  - script: 'dotnet test $(backendDirName)'
    displayName: Server - Test

  - script: 'npm --prefix ./$(frontDirName) install ./$(frontDirName)'
    displayName: Client - installation

  - script: 'npm run build --prefix $(frontDirName)'
    displayName: Client - Build        

- job: Mac
  pool:
    vmImage: 'macos-10.13'
  strategy:
    maxParallel: 2    
    matrix:
      Debug:
        configuration: debug
      Release:
        configuration: release
  steps:
  - task: DotNetCoreInstaller@0
    inputs:
      packageType: 'sdk' 
      version: '2.2.100' 

  - task: NodeTool@0
    inputs:
      versionSpec: '10.15.0' 
      #checkLatest: false # Optional

  - script: 'dotnet clean $(backendDirName)/server.sln'
    displayName: Server - Clean

  - script: 'dotnet build $(backendDirName)/server.sln'
    displayName: Server - Build

  - script: 'dotnet test $(backendDirName)'
    displayName: Server - Test

  - script: 'npm --prefix ./$(frontDirName) install ./$(frontDirName)'
    displayName: Client - installation

  - script: 'npm run build --prefix $(frontDirName)'
    displayName: Client - Build



@arashbahreini add the publish artifact yaml i pasted to your last step in Windows phase.
you can also add another - script: foooooo to find the log file base on the error message.

@arashbahreini This is a problem with OpenCollective-PostInstall in CI environments. Have a look at: https://github.com/ng-packagr/ng-packagr/issues/1178

@arashbahreini were you able to get this fixed?

Going to close this one as we haven't heard back in a bit, @arashbahreini feel free to reach back out if you're still having issues!

Build + Test:WebUI: "added 2136 packages in 40.263s" When you use the YAML task below to run npm install or npm ci then you end up with it reporting back a false error, but continuing on.

- script: call npm ci
  displayName: npm install
Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexszilagyi picture alexszilagyi  路  3Comments

ThomasBarnekow picture ThomasBarnekow  路  3Comments

jabbera picture jabbera  路  3Comments

yaananth picture yaananth  路  3Comments

TheRealEdwardCullen picture TheRealEdwardCullen  路  3Comments