Home > Mobile >  Azure pipeline npm build failing for React: Unexpected token
Azure pipeline npm build failing for React: Unexpected token

Time:07-15

I have been stuck at this for a while now and similar issues don't seem to help.

In Azure DevOps, the pipeline fails at the npm build level with an error in one of the indirect dependency (check line 18 below). The error is jest-worker/build/index.js:110 _ending; SyntaxError: Unexpected token ";"

enter image description here.

The pipeline.yaml is this:

trigger:
- master

pool:
  vmImage: ubuntu-latest

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

- script: |
    npm install
  displayName: 'npm install '

- script: |
    npm run build
  displayName: 'npm run build'
  
- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: 'build'
    includeRootFolder: true
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

CodePudding user response:

The error is clear about the issue is regarding syntax. In JS file, some ';' is used and it should not be at that location. Kindly share the code block of the index.js file and check with that specific symbol which is blocking the ending.

CodePudding user response:

Are you sure about your node.JS version ? This issue has already been solved in how solve error jest-worker at run build?

  • Related