Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve 'vue-cli-service' is not recognized as an internal or external command?

I am getting an error when trying to run npm run serve. At first I installed node.js then vue as well as vue/cli. But when I am trying to run server as -> npm run serve at that time I'm getting error like 'vue-cli-service' is not recognized as an internal or external command.

I used below codes for installation:

 npm install -g vue npm install -g @vue/cli 

enter image description here

can someone guide me what to do to solve this issue ?

like image 419
Dcoder14 Avatar asked Oct 27 '19 13:10

Dcoder14


People also ask

How do you check vue CLI is installed or not?

You can verify that it is properly installed by simply running vue , which should present you with a help message listing all available commands.

Where is vue-CLI-service?

You can access the binary directly as vue-cli-service in npm scripts, or as ./node_modules/. bin/vue-cli-service from the terminal. You can run scripts with additional features using the GUI with the vue ui command.

Can I install vue CLI locally?

Installation RecapIt may be a good idea to install the Vue CLI locally so that you can lock the version that you are going to be using.


2 Answers

I think you are using cmd in windows.

Try deleting the node_modules folder and after that run npm i from the cmd.

Then try running npm run serve again and see if it works this time

like image 85
s4k1b Avatar answered Sep 18 '22 08:09

s4k1b


Install vue/cli-service globally

npm install @vue/cli-service -g 

This will install global npm package.

@vue/cli-service is usully installed as global, because you do not usually copy these types of packages to every project.

If the global npm package gets corrupted, it is not stored in node_modules folder, but rather in other depending on the os. Therefore removing node_modules does not help. Locations for global node_modules folders are

  • %USERPROFILE%\AppData\Roaming\npm\node_modules (Win10) or
  • /usr/local/lib/node_modules (Linux),

check this stack overflow post on how to locate global packages.

like image 37
Scholtz Avatar answered Sep 17 '22 08:09

Scholtz