. Advertisement .
..3..
. Advertisement .
..4..
“‘Vue-cli-service’ is not recognized as an internal or external command” is a common problem. What is the cause of it, and how to fix it? Let’s read this article to find out the best answer.
How does the error “‘vue-cli-service’ is not recognized as an internal or external command” happen?
When you work with VueJS, you can get the following error:
‘vue-cli-service’ is not recognized as an internal or external command
This error is a frequent error in VueJS. The primary cause of this error is when the Vue executable file is not placed in Node’s bin directory. Therefore, it cannot locate the Vue command when you supply the command to execute your Vue application and reports this error. In this article, we will discuss this mistake and several possible solutions. There are many ways to handle this error. Let’s follow the next part to understand all of them.
How to solve this problem?
Solution 1: Updating the package.json file
Updating the package.json file is the simplest solution to solve this problem. All the modules listed on the package.json file just need to be installed. Look at the following command:
npm install
Solution 2: Installing vue-cli
The second solution we suggest is installing vue-cli. First, let’s uninstall vue-cli by running the command below:
npm uninstall vue-cli -g
The next step is globally installing both vue/cli and vue/cli-service as below:
npm install -g @vue/cli-service
npm install -g @vue/cli
Finally, you need to run the serve command as the following:
npm run serve
Solution 3: Removing the package-lock.json file and node modules folder
If the above solutions do not work, you can remove the package-lock.json file and node modules folder and then reinstall them with the npm install command. The folder and file can be deleted manually or via the terminal. Look at the example below to remove them from the terminal.
// Removing the node_modules folder and package-lock.json file
rm -rf node_modules
rm -f package-lock.json
// Cleaning the npm cache
npm cache clean --force
// Installing the packages
npm install
Conclusion
ITtutoria has given you some solutions to fix the “‘vue-cli-service’ is not recognized as an internal or external command” problem. If you have any questions, please leave your comment below. We will respond as possible. Thank you for your reading!
Read more
→ Export ‘default’ (imported as ‘Vue’) was not found in ‘vue’- How To Solve It?
Leave a comment