azure-devopsazure-pipelinesazure-pipelines-yamlazure-pipelines-build-taskazure-pipelines-release-task

reactJS artifact directory unreachable during deploy even if it's well compiled in Azure DevOps Pipeline


# 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 ?


Solution

  • 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