使用vue2進(jìn)行開發(fā)時(shí),安裝element-ui后,npm編譯運(yùn)行報(bào)錯(cuò):
?ERROR ?Failed to compile with 1 error ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?23:27:37
?error ?in ./src/main.js
Module not found: Error: Can't resolve 'element-ui' in '/Users/luchengcheng/MyApplication/VUE/yeb_front/yeb/src'
ERROR in ./src/main.js 2:0-35
Module not found: Error: Can't resolve 'element-ui' in '/Users/luchengcheng/MyApplication/VUE/yeb_front/yeb/src'webpack compiled with 1 error
package.json文件中已經(jīng)有了element-ui的版本描述,不知道為什么編譯時(shí)卻提示找不到依賴。經(jīng)排查發(fā)現(xiàn),通過npm i element-ui -S命令下載的element-ui版本為2.15.11,且下載后的element-ui文件夾中沒有l(wèi)ib目錄,懷疑此版本存在問題。后通過npm install element-ui@2.13.2 -S重新下載低版本element-ui,編譯通過。
?
造成此問題的原因還沒搞清楚,可能是版本兼容性問題,使用的vue 2版本,Vue CLI v5.0.8文章來源:http://www.zghlxwxcb.cn/news/detail-512158.html
補(bǔ)充:為了復(fù)現(xiàn)上述問題,我卸載了2.13.2版本,發(fā)現(xiàn)通過npm i element-ui -S命令安裝的版本已為2.15.12版本,編譯通過,嚴(yán)重懷疑11版本有問題。文章來源地址http://www.zghlxwxcb.cn/news/detail-512158.html
到了這里,關(guān)于Module not found: Error: Can‘t resolve ‘element-ui‘ in ‘/Users/luchengcheng/MyApplication/VUE/yeb_fr的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!