場景
新開一個項目,需要用element-plus這個ui庫,使用按需引入。
這是我項目的一些版本號
"element-plus": "^2.7.6","vue": "^3.2.13","vue-router": "^4.0.3",
過程(看解決方法的可以直接往下拉)
按照官網上輸入:npm install -D unplugin-vue-components unplugin-auto-import
直接安裝,控制臺報錯顯示:
Not Found - GET https://nexus01.authine.cn:443/repository/npm-all/unplugin-vue-components/-/unplugin-vue-components-0.27.2.tgz
npm ERR! 404
npm ERR! 404 'unplugin-vue-components@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'fzv_pc_project'
說這個插件并沒有注冊,找不到這個插件!我懵了,查了下版本號,這么多版本跟我說沒有注冊!!!!
控制臺輸入找不到依賴,然后我去vue ui 安裝,安裝好后,運行,還是報錯!!!!!
顯示:AutoImport is not a function
TypeError: Components is not a function
解決辦法
然后再去百度,下載指定版本,解決
npm install unplugin-auto-import@0.16.1
npm install unplugin-vue-components@0.25.2
結語
真是一臉懵,官網的語句不能執行,咋沒人說過,我百度也沒有百度到相關的!還好解決了,浪費我將近3個小時,一直卸載重裝刪依賴。腦殼都昏了!!!!