Vue Cli Service

Posted on  by admin

# vue.config.js

Modified1 month ago. I am getting an error when trying to run npm run serve. At first I installed node.js then vue as well as vue/cli.But when I am trying to run server as -> npm run serve at that time I'm getting error like 'vue-cli-service' is not recognized as an internal or external command.

I used below codes for installation:. can someone guide me what to do to solve this issue ?

22 gold badges1111 silver badges2020 bronze badges.

2020 bronze badges. I think you are using cmd in windows. Try deleting the node_modules folder and after that run npm i from the cmd.

Then try running npm run serve again and see if it works this time.

11 gold badge55 silver badges1414 bronze badges. 1414 bronze badges. This will install global npm package.

@vue/cli-service is usully installed as global, because you do not usually copy these types of packages to every project.

查看所有的可用命令 #

If the global npm package gets corrupted, it is not stored in node_modules folder, but rather in other depending on the os.

Therefore removing node_modules does not help. Locations for global node_modules folders are. %USERPROFILE%\AppData\Roaming\npm\node_modules (Win10) or.

/usr/local/lib/node_modules (Linux),. check this stack overflow post on how to locate global packages. 11 gold badge1717 silver badges2020 bronze badges.

2020 bronze badges. it will depend on the package manager you are using. delete node_modules. if you are using yarn run yarn or yarn install and then yarn serve.

if you are using npm run npm install and then npm run serve. Ntwari Clarance LiberisteNtwari Clarance Liberiste. In my case, the package @vue/cli-service is installed in my local node_modules environment, but not my global environment, so it cannot be used as a command. I type .\node_modules\.bin\vue-cli-service serve and it works.

vue.config.js #

Lucien ZhangLucien Zhang. As it is mentioned in terminal that node_modules is missing from your project, so you can't directly use npm run serve, first you have to do npm install then do npm run serve. It will work fine.

Shubham SharmaShubham Sharma.

  • In my case I ran below commands in GitBash and it worked fine. Kiran ModiniKiran Modini. If you are using cmd in windows. deleting the node_modules folder and after that run npm istall fromthe cmd.

  • run npm run serve and see if it works this time. Ali RazaAli Raza. In my case, I have checked the folder of node_modules was missing.

  • I am using Windows. So I run this in cmd. Then I check it in localhost like usual. This issue mostly happens when either @vue/cli is not installed or in most cases,.

缓存和并行处理 #

@vue/cli is already installed and you are currently working on a project and when running. yarn serve or npm run serve. Most at times, this issue is been caused by broken dependencies.to fix this issue, simple run.

Not the answer you're looking for? Browse other questions tagged vue.jsvue-cli-3 or ask your own question.

yarn install or npm install. depending on your package manager. Romanric AkamRomanric Akam. well after trying all the solutions above and it still haven't worked for you then you probably have a stupid space in the full directory of your Vue project like in my case.

so remove that that space and it will work from then on.

vue-cli-service inspect #

Muhammad KashifMuhammad Kashif. Remember to set the NODE_ENV=development and run npm install again. William KellerWilliam Keller.

Try changing the project path to one without spaces, it worked on windows 10.

Maher FakhourMaher Fakhour. I had faced the same problem in windows. Thenfirst I deleted the node_module.

then I run npm install. 11 gold badge88 silver badges1717 bronze badges. 1717 bronze badges.

Andrey -hidden-Andrey -hidden-. I had the same issue using windows + WSL2 (Ubuntu 20.04).

使用命令 #

  • Looking at the logs generated after trying to run npm i I noticed that my WSL2 environment did not have python2 installed. So to solve I ran the following commands:. Sales LopesSales Lopes. I faced the same in Windows.

  • Had to run npm install again. Then it worked perfectly. Wait, what's the difference between @vue/cli and @vue/cli-service?

# Global CLI Config

When you install both, they show different number of packages installed. The latter solved my issue actually but everyone keeps saying install @vue/cli. Justin FarrugiaJustin Farrugia.

In my case it was enough to uninstall package-lock.json and then npm i.

Stanisław SztrajtStanisław Sztrajt. I have a project, I can run it well on Linux, but i have the same issue on windows, I solve it this way (I hope in your case it works too):.

Babel #

Delete the node_modules. Install it again with npm i. 2626 bronze badges. 在一个 Vue CLI 项目中,@vue/cli-service 安装了一个名为 vue-cli-service 的命令。你可以在 npm scripts 中以 vue-cli-service、或者从终端中以 ./node_modules/.bin/vue-cli-service 访问这个命令。.

这是你使用默认 preset 的项目的 package.json:. 你可以通过 npm 或 Yarn 调用这些 script:. 如果你可以使用 npx (最新版的 npm 应该已经自带),也可以直接这样调用命令:. 你可以通过 vue ui 命令使用 GUI 运行更多的特性脚本。. 这里有一个 GUI 的 webpack Analyzer:. vue-cli-service serve 命令会启动一个开发服务器 (基于 webpack-dev-server) 并附带开箱即用的模块热重载 (Hot-Module-Replacement)。.