A few users are recently reporting that they are facing an error while trying to run the Vue-cli-service serve. During the execution, the error popped up with a message: ‘vue-cli-service’ is not recognized as an internal or external command in VueJs.
In VueJS, the ‘vue-cli-service’ isn’t perceived as an internal or external command is a typical error, and the primary purpose for happening this error is the point at which the Vue executable record/ file isn’t set into Node’s bin dir. Thus, when you provide the order to run your Vue application, it is unable to find the Vue command and just throws an error. There are multiple ways of managing this unwanted error and in this post, we will investigate this mistake and furthermore see the answer to it. Before proceeding with the solution lets us know about “vue-cli-service”.
What is Vue CLI Service?
As you likely know, CLI represents Command Line Interface, and the Vue CLI gives an entire framework for rapid Vue.js development. This implies it does a ton of drawn-out work for us and furnishes us with significant highlights out-of-the-case.
- It allows us to select which libraries our project will be using.
- It enables Hot Module Replacement (HMR).
- It Configures Webpack.
How to fix ‘Vue-CLI-Service’ is not recognized as an internal or external command
In this guide, we are going to learn how we can fix this annoying error effectively, and furthermore, we will discuss all possible solutions let’s begin with this post. Few methods are listed below follow them to fix this annoying error:
- Update package.json file
- Delete and Re-install the
- Install the Vue-CLI globally
Now, lets proceed with these solutions one by one:
1] Update package.json File
The least demanding method for managing this problem is to just refresh or update the package.json file. It will basically introduce each and every module that is listed on the package.json file. How about we see the below command model in the beneath section:
By providing this command, you can just address this mistake. Yet, on the off chance that you are as yet confronting or facing this error, you may basically follow the following methodology.
2] Delete And Re-Install The node_modules folder and package-lock.json File
In the event that arrangement One doesn’t work for you, then, at that point, you may just delete the node_modules folder and package-lock.json file and yet again introduce them by providing the order npm install You can delete the folder and file physically or by utilizing the terminal. How about we see the below command guide to delete them from the terminal.
// Command for delete the node_modules folder and package-lock.json file rm -rf node_modules rm -f package-lock.json // Command for clean the npm cache npm cache clean --force // Command for install the packages npm install
Here, by following this approach you can fix the issue. Yet, imagine a scenario where you are as yet confronting this error, then you can essentially follow the following arrangement.
3] Install The Vue-CLI Globally
On the off chance that arrangement two also doesn’t work for you then you really want to all around the world essentially install the Vue-CLI. To do as such, you want to open your terminal and provide the below command. In the event that you experience confronted with any difficulty installing Vue-CLI globally, you need to run your terminal as the administrator. Follow the listed command model:
// Command for uninstall the vue-cli npm uninstall vue-cli -g // Command for install @vue/cli-service and @vue/cli globally npm install -g @vue/cli-service npm install -g @vue/cli
Here, from the outset, we uninstalled the vue-cli and later on install it globally. At last, on the off chance that you have at any point confronted the ‘vue-cli-service’ isn’t perceived as an inside or outside command error in your Vue program then let as know in comment box.
Hope this article will provide the solution of this unwanted error. Thank you and have a nice day.