ogostos
ogostos

Reputation: 1495

Problems while setting up vue-cli

I'm trying to install Vue-cli environemnt via NPM.

npm install --global vue-cli

After that I want to create project

vue init webpack my-project

And I get an error

'vue' is not recognized as an internal or external command,
operable program or batch file.

I've read some solutions, most of them concern changing

PATH to C:\Users{YourUser}\AppData\Roaming\npm

Didn't work for me. Can anyone help.

Upvotes: 12

Views: 32320

Answers (11)

Ganesh Gavhane
Ganesh Gavhane

Reputation: 1

for Yarn -> need to install it:

npm install -g yarn

Installing Vue CLI Package:

yarn global add @vue/cli

To create project:

vue create project-name

To run:

yarn serve

Uninstalling:

yarn global remove @vue/cli

I follow "npm" package manager instead of "yarn" package manager console because yarn give me a problem while installing it;

command to install Vue CLI:

npm install -g @vue/cli

For to create Vue project:

vue create "project-name"

For to run Vue project:

npm run serve

Upvotes: 0

Alok
Alok

Reputation: 10628

yarn global add @vue/cli did not work for me

So I removed using yarn global remove @vue/cli

Then I installed using npm install -g @vue/cli and its working fine.

Upvotes: 1

David Vonka
David Vonka

Reputation: 535

I was installing @vue/cli using yarn, i.e. I ran

yarn global add @vue/cli

Calling vue on windows did not work after the installation ('vue' is not recognized as an internal or external command)

What I needed to do was to add C:\Users\<MY USERNAME>\AppData\Local\Yarn\bin to path.

Upvotes: 1

Aryesh
Aryesh

Reputation: 453

1)Try to remove all the node files, npm and nvm files/folders.

2)Also, remove the PATH of node js and nvm from environment variables.

3)try commands:

   node -v
   npm -v
   nvm -v

above commands only to make sure that all the entities related to node are uninstalled. 4) install node, and if necessary install nvm(optioal), then run command

   npm install -g @vue/cli

above procedure proven to be useful for me. Just give it a try!

Upvotes: 0

sarath kumar
sarath kumar

Reputation: 1445

I follow these commands, It's work fine for me.

npm install -g vue-cli

npm install -g vue

Edit the System environment variables, and enter the following path, and if still having a problem just try to add a path in System User Variables

C:\Program Files\nodejs\node.exe;

C:\Users\{UserName}\AppData\Roaming\npm

Check vue installed in C:\Users{UserName}\AppData\Roaming\npm enter image description here

Image 1

Image 2

Image 3

Upvotes: 10

Diego
Diego

Reputation: 11

I had the same problem after searching a lot I found this solution:

You need to Add C:\Program Files\nodejs to your PATH environment variable. To do this follow these steps:

  1. Use the global Search to go to "Environment Variables"
  2. Click "Edit system environment variables"
  3. Click "Environment Variables" in the dialog
  4. In the "System Variables" box, search for Path and edit it to include C:\Program Files\nodejs.

You will have to restart any currently-opened command prompts before it will take effect.

I hope it works, good luck!

Upvotes: 1

Koko
Koko

Reputation: 31

had the same issue, i deleted my node_modules and re-install and it worked

Upvotes: 1

Bruce Cesar
Bruce Cesar

Reputation: 31

yarn add @vue/cli-service

or

npm install @vue/cli-service

is what worked for me

Upvotes: 3

Greg Funston
Greg Funston

Reputation: 11

I found this same issue with another possible problem. I had

[email protected] installed globally

npm list -g --depth=0 will display your globals

I simply uninstalled create-react-app

npm uninstall create-react-app

Vue vue-cli-service now works as expected.

Upvotes: 1

Sandy.....
Sandy.....

Reputation: 2870

I have faced simillar issue and re-installing vue-cli didn't work for me. Strange thing is vue and vue-cli get installed successfully but once I tried to create project by using below command

vue init webpack myfirstproject

I get below error:

'vue' is not recognized as an internal or external command,operable program or batch file.

Tried various solutions but nothing worked for me. Please find my NPM and Node details below:

NPM version: 6.2.0
Node version: 8.7.0

Actually the issue was "vue-cli" is not supporting to my Node(8.7.0). It requires Node >=8.9. Once I upgraded my Node version. everything is working fine.

upgrading your Node version is the correct way to deal with this issue

Upvotes: 2

ogostos
ogostos

Reputation: 1495

Well, problem was solved by simply deleting everything related to vue-cli installed before. And re-installing vue-cli.

Upvotes: 2

Related Questions