microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.47k stars 2.6k forks source link

[Question]: Azure Pipeline how to do vercel deployment? #20345

Closed atalayio closed 2 weeks ago

atalayio commented 2 weeks ago

Task name

vercel-deployment-task@1

Task version

No response

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows 11

Question

When I try to vercel deployment with azure pipeline it giving me this error: 

Unable to locate executable file: 'vercel'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file
atalayio commented 2 weeks ago

Here my yml file:

trigger:
- main

pool: Default

steps:
- task: vercel-deployment-task@1
  inputs:
    vercelProjectId: myProjectId
    vercelOrgId: myOrgId
    vercelToken: myToken
    production: true
aleksandrlevochkin commented 2 weeks ago

Hi @atalayio! Thanks for your question. Seems like this task is an extension provided by Vercel and the repo for it is here: https://github.com/vercel/vercel-azure-devops-extension

Judging by the task's source code it attempts to install the vercel npm package globally on your machine and then fails when running the vercel deploy command.

Does it work correctly when you execute the same vercel commands directly from that machine where the agent is running?

atalayio commented 2 weeks ago

Hi @atalayio! Thanks for your question. Seems like this task is an extension provided by Vercel and the repo for it is here: https://github.com/vercel/vercel-azure-devops-extension

Judging by the task's source code it attempts to install the vercel npm package globally on your machine and then fails when running the vercel deploy command.

Does it work correctly when you execute the same vercel commands directly from that machine where the agent is running?

Hey Aleksandr, thanks your answer. I tried again with adding vercel package individually to my project and sad to say nothing changed. I can use vercel commands on my local agent computer without any error.

atalayio commented 2 weeks ago

This is my package.json:

{
  "name": "visedigital.frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@nextui-org/react": "^2.4.6",
    "framer-motion": "^11.3.21",
    "lucide-react": "^0.424.0",
    "next": "14.2.5",
    "next-themes": "^0.3.0",
    "react": "^18",
    "react-dom": "^18",
    "react-icons": "^5.3.0",
    "vercel": "^37.1.1",
    "yarn": "^1.22.22"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "14.2.5",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}
atalayio commented 2 weeks ago

Now I have called "Vercel.vercel-deployment-extension-1.6.0.vsix" extension file. Azure says me install that agent local machine but I couldn't find how to do that.

aleksandrlevochkin commented 2 weeks ago

Now I have called "Vercel.vercel-deployment-extension-1.6.0.vsix" extension file. Azure says me install that agent local machine but I couldn't find how to do that.

Could you please clarify what you mean here?

Also, I think your package.json is fine, the issue is that the vercel-deployment-task installs the vercel npm package globally on your agent machine and then does not recognize the vercel command for some reason.

You can use the command npm ls -g --depth 0 to check the packages that are installed globally on your agent machine and their locations (for example, to check if the vercel package directory is in your machine's PATH)

atalayio commented 2 weeks ago

Now I have called "Vercel.vercel-deployment-extension-1.6.0.vsix" extension file. Azure says me install that agent local machine but I couldn't find how to do that.

Could you please clarify what you mean here?

Also, I think your package.json is fine, the issue is that the vercel-deployment-task installs the vercel npm package globally on your agent machine and then does not recognize the vercel command for some reason.

You can use the command npm ls -g --depth 0 to check the packages that are installed globally on your agent machine and their locations (for example, to check if the vercel package directory is in your machine's PATH)

Okay here the "npm ls -g --depth 0" command output, seems like everything okay.

C:\Users\Me>npm ls -g --depth 0
C:\Users\Me\AppData\Roaming\npm
+-- @ewanmellor/brackets-viewer@1.6.911
+-- @expo/ngrok@4.1.3
+-- eas-cli@9.2.0
+-- expo-cli@6.3.10
+-- ts-node@10.9.2
+-- typescript@5.4.5
+-- vercel@37.1.1
`-- yarn@1.22.21
aleksandrlevochkin commented 2 weeks ago

@atalayio Seems like the issue might be related to the task itself. I suggest that you open an issue in the Vercel extension repo: https://github.com/vercel/vercel-azure-devops-extension

atalayio commented 2 weeks ago

@atalayio Seems like the issue might be related to the task itself. I suggest that you open an issue in the Vercel extension repo: https://github.com/vercel/vercel-azure-devops-extension

Thanks your all help, you're right vercel extension repo page would be better for this issue.