Vue is not recognized as an internal or external command, operable program or batch file

vue 에서 잘 실행하고 있던 vue cli 명령어가 갑자기 아래와 같은 에러를 내며 작동하지 않을 때가 있다.

ex) $npm run serve 명령어 수행시 error

'vue-cli-service' is not recognized as an internal or external command 'vue-cli-service'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다

위와 같은 에러를 해결 하기 위해서는 아래와 같은 2가지 중 하나의 방법을 수행하면 된다.

당연히 node module 과 vue 는 설치 되어있어야 한다. 

$ npm install -g vue

1. vue cli 재설치 => 삭제후 재설치하여 해결한다.

$ npm uninstall vue-cil -g $ npm install -g @vue/cli

2. 1번으로 해결되지 않거나 cmd 에서 사용할 때 주로 해결하는법

먼저 해당 프로젝트의 node_module 폴더 삭제

그 후 $ npm i  명령어로 재설치 후 재기동하면 성공

$ npm run serve

# node_module 폴더 삭제 $ npm i $ npm run serve

Example: 'vue' is not recognized as an internal or external command,

I had the same issue. Here the quick fix. after running the following command (as Admin) npm install --global vue-cli It will place the vue.cmd in the following directory C:\Users\YourUserName\AppData\Roaming\npm at least for me it's there. To use vue as command in cmd. Open the cmd as admin and run the the following command. setx /M path "%path%;%appdata%\npm" Now restart the cmd and run the vue again. It should work just fine.

Tags:

Misc Example

Related

everything was installed correctly. but whenever I try to create project, it says "'vue' is not recognized as an internal or external command". I installed and re-installed but didn't work. npm was also added to environmental variable path.

C:\Users\touha\Desktop>npm list -g --depth=0 C:\Users\touha\.npm-packages `-- @vue/ C:\Users\touha\Desktop>vue ui 'vue' is not recognized as an internal or external command, operable program or batch file. C:\Users\touha\Desktop>

Vuejs is by far the most popular JavaScript framework nowadays. So, if you want to build an appealing and brilliant web application, definitely you should learn Vue. Also, it’s becoming more popular day by day. The job opportunities are a lot for this framework. Besides, they have a community of great and active people who can help you in anytime. So, Vue-CLI is one of the many features of Vue. One of the most common problems that beginners face is how to install and configure it. Furthermore, you will learn how to solve Vue command not found error step by step with an example.

1. What’s Vue-CLI?

In the first place, you must know what’s Vue-CLI? Shortly, Vue-CLI let you install Vue applications or templates with the command line. For instance, when you install Laravel, you use a command line, so, the same case with Vue.

2. How to install Vue-CLI

To install Vue-CLI, you must have Nodejs and Git installed on your system. So, if you don’t have Nodejs, just go to their website and download the current version.

Install Vue-CLI with the following command

npm install -g vue-cli

It will install Vue-CLI globally, which according to the documentation when you install any NPM package globally, you can access it through the command line.

Open your command line and run the following command.

vue init webpack my-project

The above command normally installs a demo project form Webpack, but you should get an error.

Vue is not recognized as an internal or external command, operable program or batch file
‘vue’ is not recognized as an internal or external command

Or your error might be list Vue command not found.

In order to solve this problem, you should add the Vue path to your environment variable manually. So, here is how you can do that.

  • Press Win + R
  • Type “control sysdm.cpl,,3” and press enter
  • Press N to open environment variables.
  • Select the path and click Edit.
  • Click new to add a new path.
  • Paste the path to NPM folder in your AppData.
  • Click OK for all windows and you are done.

NPM path is normally in the following folder. Just change your username on your system.

C:\Users\UserName\AppData\Roaming\npm

Your show hidden files option must be on the view this files.

Vue is not recognized as an internal or external command, operable program or batch file
Add new windows env path

You are done now. So, this time if you open the command line and type the following command, it should install the Webpack demo template in the current directory.

vue init webpack my-project

After installing, you can run the following command to open the project in the browser.

npm run dev

So, it will run a server in the following URL

http://localhost:8080/#/

Conclusion

All in all, it was that easy. Besides learning what’s Vue-CLI, you learned how to install it from the command line. So, if you have any questions or problems related to how to solve Vue command not found, feel free to comment it below.

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.

How do I install vue on Windows 10?

Check the version number you have installed by using the command: vue --version . To install Vue..
Open a command line (ie. Windows Command Prompt or PowerShell)..
Create a new project folder: mkdir VueProjects and enter that directory: cd VueProjects ..
Install Vue. js using Node Package Manager (npm):.

How do I install vue?

Go to the home site https://vuejs.org/v2/guide/installation.html of VueJS and download the vue. js as per need. There are two versions for use - production version and development version.

Where is vue cli service installed?

Inside a Vue CLI project, @vue/cli-service installs a binary named 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.