While are you trying to run npm run serve, then you will get ‘vue-cli-service’ is not recognized as an internal or external command this error. Let us take a look at every solution.
In this article, we will discuss about this ‘vue-cli-service’ is not recognized as an internal or external command error in VueJs. And how to resolve the error all the possible solutions with examples.
How ‘vue-cli-service’ is not recognized as an internal or external command Error Occurs?
Most of the time you get this error when are you trying to run npm run serve.
'vue-cli-service' is not recognized as an internal or external command
How To Fix ‘vue-cli-service’ is not recognized as an internal or external command Error?
There are different ways to fix ‘vue-cli-service’ is not recognized as an internal or external command this error. Let us take a look at every solution.
- How To Fix ‘vue-cli-service’ is not recognized as an internal or external command Error?
For the solve ‘vue-cli-service’ is not recognized as an internal or external command error First you have to package name change from vue-cli to @vue/cli. If you have the previous vue-cli then uninstall vue-cli And install @vue/cli-service and @vue/cli both globally by running this command below. I hope your error will be solved.
- ‘vue-cli-service’ is not recognized as an internal or external command
You need to delete node_modules first then run npm install and then run the serve command: npm run serve. If that didn’t help then you have to delete your file node_modules and package-lock.json by below the command. Then clear npm cache by running this command: npm cache clean –force then run npm install. Now, I hope your error will be solved.
Solution 1: Install vue-cli
If you have vue-cli then you have to uninstall old vue-cli by running this command:
# uninstall old vue cli
npm uninstall vue-cli -g
And then install @vue/cli-service and @vue/cli globally by running this command:
# install @vue/cli-service and @vue/cli globally
npm install -g @vue/cli-service
npm install -g @vue/cli
Now, you can run the serve command.
npm run serve
Now, I hope your error will be solved. If the error is not resolved, try to below solution.
Solution 2: npm run
For the solve this error this way first you have to delete node-modules. Then run npm by below the command:
npm install
Then run serve
npm run serve
If didn’t help the fix your error. Then try to this solution.
Solution 3: Follow this
To solve this error try to delete your node_modules
and package-lock.json
file by below this command:
# 👇️ delete node_modules and package-lock.json
rm -rf node_modules
rm -f package-lock.json
Then clear your npm cache by this command:
# 👇️ clean npm cache
npm cache clean --force
Then install npm by this command:
npm install
Now, I hope your error will be solved.
Conclusion
In this article, we have discussed what causes the error and we have discussed ways to fix the error.
we hope this article has been informative. Thank you for reading. Kindly comment and let us know if you found it helpful.