question

KavithaLakshmiAngajala-6589 avatar image
0 Votes"
KavithaLakshmiAngajala-6589 asked SaileshSinghChauhan-6276 edited

Build pipeline failed with error 'Error: Npm failed with return code: 254'

I was trying to develop data factory pipeline using VSO deployments, I have configured my data factory to a 'Azure DevOps Git' repository with following details

Collaboration branch : master
Publish branch : adf_publish
Root folder : /ADF

I have used the following YAML script

 # Sample YAML file to validate and export an ARM template into a build artifact
 # Requires a package.json file located in the target repository
    
 trigger:
 - master #collaboration branch
    
 pool:
   vmImage: 'ubuntu-latest'
    
 steps:
    
 # Installs Node and the npm packages saved in your package.json file in the build
    
 - task: NodeTool@0
   inputs:
     versionSpec: '10.x'
   displayName: 'Install Node.js'
    
 - task: Npm@1
   inputs:
     command: 'install'
     verbose: true
   displayName: 'Install npm package'
    
 # Validates all of the Data Factory resources in the repository. You'll get the same validation errors as when "Validate All" is selected.
 # Enter the appropriate subscription and name for the source factory.
    
 - task: Npm@1
   inputs:
     command: 'custom'
     workingDir: '$(Build.SourcesDirectory)/ADF'
     customCommand: 'run build validate $(Build.Repository.LocalPath)/ADF /subscriptions/[My Subscription ID]/resourceGroups/[My ResourceGroup name]/providers/Microsoft.DataFactory/factories/[My Datafactory name]'
   displayName: 'Validate'
    
 # Validate and then generate the ARM template into the destination folder, which is the same as selecting "Publish" from the UX.
 # The ARM template generated isn't published to the live version of the factory. Deployment should be done by using a CI/CD pipeline. 
    
 - task: Npm@1
   inputs:
     command: 'custom'
     workingDir: '$(Build.SourcesDirectory)/ADF'
     customCommand: 'run build export $(Build.Repository.LocalPath)/ADF /subscriptions/[My Subscription ID]/resourceGroups/[My ResourceGroup name]/providers/Microsoft.DataFactory/factories/[My Datafactory name] "ArmTemplate"'
   displayName: 'Validate and Generate ARM template'
    
 # Publish the artifact to be used as a source for a release pipeline.
    
 - task: PublishPipelineArtifact@1
   inputs:
     targetPath: '$(Build.Repository.LocalPath)/ADF/ArmTemplate'
     artifact: 'ArmTemplates'
     publishLocation: 'pipeline'


Below is the error I am getting
82651-buildpipelinevalidationfailed-completeerrormessage.png


Package.json file was placed under '/ADF' folder. And below is the folder structure of my repo
82385-folderstructure.png

azure-data-factory
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Followed the same unable to rectify the error.

0 Votes 0 ·

Ares you still facing the issue?

0 Votes 0 ·

Yes the issue still not resolved

0 Votes 0 ·
JayVee-4791 avatar image
0 Votes"
JayVee-4791 answered JayVee-4791 published

From you YAML pipeline, choose the folder where the package-json is located

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SaileshSinghChauhan-6276 avatar image
0 Votes"
SaileshSinghChauhan-6276 answered SaileshSinghChauhan-6276 edited

I am using same YAML for automated deployment, I was also getting similar error.

I am suggesting some changes in your YAML file. Please, implement them. I hope it will work for you also.

  1. You have kept package.json file inside ADF folder. I have kept it inside a folder called package in root directory not in ADF folder.

  2. At line number 31 and 41 I have used value for workingDir as this value '$(Build.Repository.LocalPath)/package' not '$(Build.SourcesDirectory)/ADF'

  3. At line number 49 for targetPath I have used '$(Build.Repository.LocalPath)/package/ArmTemplate' as value. This path should not make much difference.

I expect if you will make suggested changes in point 1 and 2 your deployment would succeed

Thanks

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.