Mea
Mea

Reputation: 31

Installing the Vercel CLI in Visual Studio Code

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

Upvotes: 3

Views: 15983

Answers (5)

Soumil Mukhopadhyay
Soumil Mukhopadhyay

Reputation: 1

I figured out the following and it worked on Windows:

  1. Close all terminals, then open Command Prompt and Run as Administrator
  2. cd into your project directory path
  3. npm run build (ensure that all dependencies are installed before that)
  4. No need to install vercel again, try vercel --version

It should work, and then you can deploy your project on Vercel by referring to https://blog.logrocket.com/9-ways-deploy-react-app-free/

Upvotes: 0

Nidhi
Nidhi

Reputation: 61

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!

Upvotes: 3

Bukenya KizzaRoland
Bukenya KizzaRoland

Reputation: 821

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

Upvotes: 4

Ted's Projects
Ted's Projects

Reputation: 137

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

Upvotes: 0

Golamrabbi Azad
Golamrabbi Azad

Reputation: 781

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

Upvotes: 4

Related Questions