. Advertisement .
..3..
. Advertisement .
..4..
I encountered the following problem in completing my work:
'vue-cli-service' is not recognized as an internal or external command.
Below is the code I ran:
npm install -g vue
npm install -g @vue/cli
What’s causing it, and how can it be resolved in the “vue cli service is not recognized as an internal or external command“ in the javascript?
The cause:
Looking at your problem I find that the package
@vue/cli-service
is set up in your local node_modules environment but it should be installed as global, so it causes the problem ”Vue cli service is not recognized as an internal or external command”.Solution:
In the case
cmd
is being used in windows. You have to remove thenode_modules
folder and from the cmd let’s operatenpm i
. After that, attempt runningnpm run serve
once more time and it will work well at that time.Globally install vue/cli-service
This will install global NPM package.
@vue/cli-service
is installed globally because you don’t usually copy these packages to every project.If the global package npm gets corrupted it will not be stored in the
node_modules
folder but in another depending on the OS. It is not possible to remove node_modules. These are the locations for global node_modules directories%USERPROFILE%\AppData\Roaming\npm\node_modules
(Win10)/usr/local/lib/node_modules
(Linux),This stack overflow post How to Locate Global Packages