create account

HiveSnap - 建設 Nuxt App 過程遇上 prettier 引起的 Module Error by nuagnorab

View this thread on: hive.blogpeakd.comecency.com
· @nuagnorab ·
$4.70
HiveSnap - 建設 Nuxt App 過程遇上 prettier 引起的 Module Error
![image.png](https://cdn.steemitimages.com/DQmZ1fYrekxXK3VTqxuP4ZQ6HQohEDCLesRwSSULvcurzMJ/image.png)


今天是週未假期的第一天,本想輕鬆搞一搞放置多時的 side project。

可惜一上手不久,剛想把項目 ```npm run dev``` 起來繼續 develop, 按下 Enter 鍵後一大堆 ERROR 彈出,根本完全不能打開項目 。令我十份頭痛。

粗看一下 ERROR 提示

```✖ 1 problem (1 error, 0 warnings)
[1]   1 error and 0 warnings potentially fixable with the `--fix` option.
```

心想: 難度就如此簡單打個指令就能除錯!? 先試試。

結果不言而喻,ERROR 顯視的提示大多都比較坑。

只好自己來看錯在那裡,相信加上 Google 大神,可以很快 debug 。

```
12:35  error  Replace `·indeterminate·color="grey·lighten-5"` with `⏎················indeterminate⏎················color="grey·lighten-5"⏎··············`  prettier/prettier
```

從我的 ERROR 上看得出是其中 prettier 出了問題,看樣子是 ESlint + Prettier rules 有衝突,當中有一個覺得需要對空格數量進行修改。

可是文件內有很多都有一樣的問題,要是每個都改,花的時間不值。

請求 Google 大神,怎樣可以自動修改 prettier 設下的 rules 呢?

最後找到方法,在 cmd 上打上

```
npx prettier --write "**/*.{vue,js}"
```

完成! 可以繼續工作了!
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 209 others
👎  
properties (23)
authornuagnorab
permlinkhivesnap-nuxt-app-prettier-module-error
categoryhive-105017
json_metadata{"app":"peakd/2020.06.1","format":"markdown","tags":["cn","cn-curation","palnet","neoxian","build-it","upfundme"],"image":["https://cdn.steemitimages.com/DQmZ1fYrekxXK3VTqxuP4ZQ6HQohEDCLesRwSSULvcurzMJ/image.png"]}
created2020-06-27 07:43:36
last_update2020-06-27 07:43:36
depth0
children0
last_payout2020-07-04 07:43:36
cashout_time1969-12-31 23:59:59
total_payout_value2.366 HBD
curator_payout_value2.334 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length882
author_reputation125,097,310,898,849
root_title"HiveSnap - 建設 Nuxt App 過程遇上 prettier 引起的 Module Error"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,202,100
net_rshares13,849,557,820,831
author_curate_reward""
vote details (274)