0
# This task install dependencies & compile the code.
- script: |
    npm install
    npm install @rollup/rollup-linux-x64-gnu --save-optional
    npm install -D vitest happy-dom @testing-library/react
    npm install -g firebase-tools
    npm run build
  displayName: 'npm install & build'

# This task deploys to firebase.
- script: |
    pwd
    ls -al
    firebase target:apply hosting default $(PROJECT_ID)
    firebase deploy
  displayName: 'Deploy to Firebase'
  env:
    GOOGLE_APPLICATION_CREDENTIALS: $(GOOGLE_APPLICATION_CREDENTIALS)
    PROJECT_ID: $(PROJECT_ID)
/home/vsts/work/1/s
total 404
drwxr-xr-x   9 vsts docker   4096 Jun 10 15:48 .
drwxr-xr-x   6 vsts docker   4096 Jun 10 15:47 ..
-rw-r--r--   1 vsts docker     49 Jun 10 15:47 .eslintignore
-rw-r--r--   1 vsts docker   1261 Jun 10 15:47 .eslintrc.cjs
drwxr-xr-x   8 vsts docker   4096 Jun 10 15:47 .git
-rw-r--r--   1 vsts docker    279 Jun 10 15:47 .gitignore
drwxr-xr-x   3 vsts docker   4096 Jun 10 15:47 .husky
-rw-r--r--   1 vsts docker    130 Jun 10 15:47 .prettierrc
drwxr-xr-x   3 vsts docker   4096 Jun 10 15:47 .vite
-rw-r--r--   1 vsts docker   1301 Jun 10 15:47 README.md
-rw-r--r--   1 vsts docker     67 Jun 10 15:47 commitlint.config.cjs
-rw-r--r--   1 vsts docker    346 Jun 10 15:47 components.json
drwxr-xr-x   3 vsts docker   4096 Jun 10 15:48 dist # WELL GENERATED
-rw-r--r--   1 vsts docker    411 Jun 10 15:47 index.html
-rw-r--r--   1 vsts docker     67 Jun 10 15:47 newFile.cjs
drwxr-xr-x 534 vsts docker  20480 Jun 10 15:48 node_modules
-rw-r--r--   1 vsts docker 292394 Jun 10 15:48 package-lock.json
-rw-r--r--   1 vsts docker   2518 Jun 10 15:48 package.json
-rw-r--r--   1 vsts docker   3248 Jun 10 15:47 pipeline.yml
-rw-r--r--   1 vsts docker     81 Jun 10 15:47 postcss.config.js
drwxr-xr-x   2 vsts docker   4096 Jun 10 15:47 public
drwxr-xr-x  13 vsts docker   4096 Jun 10 15:47 src
-rw-r--r--   1 vsts docker   1417 Jun 10 15:47 tailwind.config.js
-rw-r--r--   1 vsts docker    670 Jun 10 15:47 tsconfig.json
-rw-r--r--   1 vsts docker    233 Jun 10 15:47 tsconfig.node.json
-rw-r--r--   1 vsts docker    405 Jun 10 15:47 vite.config.ts

✔  Applied hosting target default to <firebase-instance-name>

Updated: default (<firebase-instance-name>)

=== Deploying to '<firebase-instance-name>'...

i  deploying hosting
i  hosting[<firebase-instance-name>]: beginning deploy...

Error: Directory 'dist' for Hosting does not exist.

I'm deploying a reactJS in firebase hosting, I can easily deploy it from my local after building the project but in the Azure Pipeline, it can't find the generated folder, even if it's well generated and in the current working directory where we deploy, it still says that's the directory doesn't exist.

Anyone who faced this issue before ?

11
  • 1
    Can you provide the details of you pipeline YAML and the debugging logs of the failed deployment? What agent are you using to runt he deploy job, the Microsoft-hosted agents or self-hosted agents installed on your local? You mentioned you can manually successfully run the deployment from your local, do you call some commands to run the deployment? If so, do you use the same commands with the same arguments in pipeline? Commented Jun 11, 2024 at 8:48
  • Hello, thanks for your response, I actually use a vmImage: ubuntu-latest. Yes i use exactly the same commands in my pipeline as i used them in local. I will edit the post to add the build task and the deployment task. Commented Jun 11, 2024 at 9:10
  • No problem. Go ahead. @RamiDH Commented Jun 11, 2024 at 9:13
  • Do you have any other tasks set between the two tasks ('npm install & build' and 'Deploy to Firebase')? @RamiDH Commented Jun 11, 2024 at 9:21
  • No, the previous tasks download some config files and the google service account file than export the var env GOOGLE_APPLICATION_CREDENTIALS, and auth to gcp. that's all, but nothing related to the build or the deploy tasks. Commented Jun 11, 2024 at 9:25

1 Answer 1

0

I actually fixed it :), the issue was that azure DevOps uses the /1/s directory and not the home directory by default. so a simple 'cd ~' fixed the problem :D

Sign up to request clarification or add additional context in comments.

2 Comments

Since the answer can resolve your issue, maybe, you can accept it. This could be also helpful for other people who are looking for a solution of the similar issues. @RamiDH
sorry, my bad, i'm new here. DONE, i've accepted it. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question