karthik
karthik

Reputation: 3

##[error]Not found workingDirectory: /home/vsts/work/1/s/cd Frontend/Frontend

If you have any deployment steps, you can add them here.

how to solve this, i want to build the angular with nodejs, during that it throughs this error

Upvotes: 0

Views: 2607

Answers (1)

SiddheshDesai
SiddheshDesai

Reputation: 8195

If you want to build the node app with Azure DevOps pipeline, given your code is in Azure repository, You need to make use of predefined variable below:-

$(System.DefaultWorkingDirectory)

When I used my repository name directly without the predefined variable above, I received the same error code, Refer below:-

enter image description here

I used the $(System.DefaultWorkingDirectory) that will read the source code from my Azure repository, As I directly have my app in the repository, without any directory structure like Frontend/Frontend I only used $(System.DefaultWorkingDirectory) variable as working directory. In your case if you have a Frontend app inside a Frontend Folder, Add $(System.DefaultWorkingDirectory)/Frontend > $(System.DefaultWorkingDirectory) is your repository which will read Frontend folder, Specify the internal Frontend folder with / .

My Azure repository:-

enter image description here

My YAML file:-

trigger:
  branches:
    include:
    - master

pool:
  vmImage: ubuntu-latest

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

- script: |
    npm install -g @angular/cli
    npm install
    ng build 
  displayName: 'npm install and build'
  workingDirectory: '$(System.DefaultWorkingDirectory)'

- script: |
    npm install -g @angular/cli
    cd Frontend/Frontend
    npm install -g npm@latest
    npm cache clean --force
    npm rm -rf node_modules && rm package-lock.json
    npm install
  displayName: 'Install Angular CLI and Node.js dependencies'
  workingDirectory: '$(System.DefaultWorkingDirectory)'

- script: |
    ng build 
  displayName: 'Build Angular app'
  workingDirectory: '$(System.DefaultWorkingDirectory)'

- script: |
    npm test
  displayName: 'Run Node.js tests'
  workingDirectory: '$(System.DefaultWorkingDirectory)'

#

Output:-

enter image description here

Upvotes: 0

Related Questions