npm run serve后,组件命名是不是有问题。。

来源:1-1 如何进行真机调试

慕侠3297407

2022-07-06 04:23:30

PS C:\Users\18660\Desktop\jingdong> npm run serve
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

> jingdong@0.1.0 serve
> vue-cli-service serve

 INFO  Starting development server...


 ERROR  Failed to compile with 1 error                                                                                                                   03:39:15
[eslint]
C:\Users\18660\Desktop\jingdong\src\components\Docker.vue
  14:10  error  Component name "Docker" should always be multi-word  vue/multi-word-component-names 

C:\Users\18660\Desktop\jingdong\src\components\Toast.vue
  1:1  error  Component name "Toast" should always be multi-word  vue/multi-word-component-names    

C:\Users\18660\Desktop\jingdong\src\views\home\Home.vue
  15:9  error  Component name "Home" should always be multi-word  vue/multi-word-component-names    

C:\Users\18660\Desktop\jingdong\src\views\home\Nearby.vue
  48:10  error  Component name "Nearby" should always be multi-word  vue/multi-word-component-names 

C:\Users\18660\Desktop\jingdong\src\views\login\Login.vue
  56:9  error  Component name "Login" should always be multi-word  vue/multi-word-component-names   

C:\Users\18660\Desktop\jingdong\src\views\orderConfirmation\Order.vue
  62:10  error  Component name "Order" should always be multi-word  vue/multi-word-component-names  

C:\Users\18660\Desktop\jingdong\src\views\register\Register.vue
  60:9  error  Component name "Register" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\shop\Cart.vue
  115:10  error  Component name "Cart" should always be multi-word  vue/multi-word-component-names  

C:\Users\18660\Desktop\jingdong\src\views\shop\Content.vue
  104:10  error  Component name "Content" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\shop\Shop.vue
  52:10  error  Component name "Shop" should always be multi-word  vue/multi-word-component-names

✖ 10 problems (10 errors, 0 warnings)


You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
ERROR in [eslint]
C:\Users\18660\Desktop\jingdong\src\components\Docker.vue
  14:10  error  Component name "Docker" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\components\Toast.vue
  1:1  error  Component name "Toast" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\home\Home.vue
  15:9  error  Component name "Home" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\home\Nearby.vue
  48:10  error  Component name "Nearby" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\login\Login.vue
  56:9  error  Component name "Login" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\orderConfirmation\Order.vue
  62:10  error  Component name "Order" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\register\Register.vue
  60:9  error  Component name "Register" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\shop\Cart.vue
  115:10  error  Component name "Cart" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\shop\Content.vue
  104:10  error  Component name "Content" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\shop\Shop.vue
  52:10  error  Component name "Shop" should always be multi-word  vue/multi-word-component-names

✖ 10 problems (10 errors, 0 warnings)


webpack compiled with 1 error


 在 03:41:33 时从 2022/7/6 还原的会话内容 

版权所有 (C) Microsoft Corporation。保留所有权利。

尝试新的跨平台 PowerShell https://aka.ms/pscore6

PS C:\Users\18660\Desktop\jingdong> npm run serve
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

> jingdong@0.1.0 serve
> vue-cli-service serve

 INFO  Starting development server...


 ERROR  Failed to compile with 1 error                                                                                                                   03:42:30

[eslint]
C:\Users\18660\Desktop\jingdong\src\components\Docker.vue
  14:10  error  Component name "Docker" should always be multi-word  vue/multi-word-component-names 

C:\Users\18660\Desktop\jingdong\src\components\Toast.vue
  1:1  error  Component name "Toast" should always be multi-word  vue/multi-word-component-names    

C:\Users\18660\Desktop\jingdong\src\views\home\Home.vue
  15:9  error  Component name "Home" should always be multi-word  vue/multi-word-component-names    

C:\Users\18660\Desktop\jingdong\src\views\home\Nearby.vue
  48:10  error  Component name "Nearby" should always be multi-word  vue/multi-word-component-names 

C:\Users\18660\Desktop\jingdong\src\views\login\Login.vue
  56:9  error  Component name "Login" should always be multi-word  vue/multi-word-component-names   

C:\Users\18660\Desktop\jingdong\src\views\orderConfirmation\Order.vue
  62:10  error  Component name "Order" should always be multi-word  vue/multi-word-component-names  

C:\Users\18660\Desktop\jingdong\src\views\register\Register.vue
  60:9  error  Component name "Register" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\shop\Cart.vue
  115:10  error  Component name "Cart" should always be multi-word  vue/multi-word-component-names  

C:\Users\18660\Desktop\jingdong\src\views\shop\Content.vue
  104:10  error  Component name "Content" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\shop\Shop.vue
  52:10  error  Component name "Shop" should always be multi-word  vue/multi-word-component-names

✖ 10 problems (10 errors, 0 warnings)


You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
ERROR in [eslint]
C:\Users\18660\Desktop\jingdong\src\components\Docker.vue
  14:10  error  Component name "Docker" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\components\Toast.vue
  1:1  error  Component name "Toast" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\home\Home.vue
  15:9  error  Component name "Home" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\home\Nearby.vue
  48:10  error  Component name "Nearby" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\login\Login.vue
  56:9  error  Component name "Login" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\orderConfirmation\Order.vue
  62:10  error  Component name "Order" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\register\Register.vue
  60:9  error  Component name "Register" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\shop\Cart.vue
  115:10  error  Component name "Cart" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\shop\Content.vue
  104:10  error  Component name "Content" should always be multi-word  vue/multi-word-component-names

C:\Users\18660\Desktop\jingdong\src\views\shop\Shop.vue
  52:10  error  Component name "Shop" should always be multi-word  vue/multi-word-component-names

✖ 10 problems (10 errors, 0 warnings)


webpack compiled with 1 error


写回答

1回答

好帮手慕慕子

2022-07-06

同学你好,是eslint的问题,规定了组件的名称格式,要写成多词的格式,不能是单个词。

可以在设置eslint的规则下添加下图代码,关闭该项校验,如下:

https://img1.sycdn.imooc.com/climg/629576c4092d069f07860130.jpg

祝学习愉快!


0

0 学习 · 15276 问题

查看课程