Installing the Vercel CLI in Visual Studio Code

9.9k views Asked by At

I have logged in to Vercel using my Github account.

I run the command npm install -g vercel in Visual Studio Code (in the relevant project directory), it installs successfully but when I run 'vercel' or 'vercel login' it gives me the error:

*vercel : The term 'vercel' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • vercel login
  •   + CategoryInfo          : ObjectNotFound: (vercel:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException*
    

Any advice will be appreciated!! Thanks

4

There are 4 answers

0
Golamrabbi Azad On

Your PowerShell doesn't know the path where vercel located. To run vercel scripts you have to manually install or run the .ps1 script for the Powershell.

Run this script with PowerShell: C:\Users\YourUserName\AppData\Roaming\npm\vercel.ps1

0
Ted's Projects On

Just if you still have this problem running vercel --prod gave me an error that said "not recognized" npm vercel --prod worked thought

1
Bukenya KizzaRoland On

if you are using ubuntu and you used yarn to install vercel just head to your terminal and run this command export PATH=$PATH:~/.yarn/bin

0
Nidhi On

The above solutions didn't work for windows at all.

Here's how I fixed it:

Open CMD in "Administrator" mode.

npm cache clear --force

npm install

npm config set cache C:\Users\myname\AppData\Roaming\npm-cache

npm config set prefix C:\Users\myname\AppData\Roaming\npm

Now do:

npm i -g vercel

vercel --version

It worked!