Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ENOENT: no such file or directory, open '/home/vsts/work/package.json'

I have repo in git and trying to build with yaml in vsts. In repository there is only newly created angular project without any changes. When trying to run pipeline with default angular yaml i get following error when running "ng build --prod"

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- script: |
    npm install -g @angular/cli
    npm install
    ng build --prod
  displayName: 'npm install and build'


# Publish Artifacts
- task: PublishBuildArtifacts@1
  inputs:
    artifactName: dist
    pathtoPublish: 'dist'
like image 305
Łukasz Misztal Avatar asked Apr 15 '20 19:04

Łukasz Misztal


2 Answers

OK I found the answer. I needed to add:

workingDirectory: '$(Build.SourcesDirectory)/projectFolderName'

below:

displayName: 'npm install and build'
like image 145
Łukasz Misztal Avatar answered Sep 19 '22 11:09

Łukasz Misztal


You would need a file package.json at the specified location under

workingDirectory: '$(Build.SourcesDirectory)/<path_to_file_packages.json>'

The json file could be consisting of

{
     "scripts":{
          "build":"node node_modules/@microsoft/azure-data-factory-utilities/lib/index"
     },
     "dependencies":{
          "@microsoft/azure-data-factory-utilities":"^0.1.6"
     }
} 

The latest version of Azure Data Factory Utilities should match the version number here https://www.npmjs.com/package/@microsoft/azure-data-factory-utilities

like image 41
Vyshakh Unnikrishnan Avatar answered Sep 16 '22 11:09

Vyshakh Unnikrishnan