Vite使用報(bào)錯(cuò)解決方法合集
1.npm install 報(bào)錯(cuò)
解決方法:運(yùn)行下列命令即可
npm audit fix --force
2.vite創(chuàng)建vue3項(xiàng)目報(bào)錯(cuò)
報(bào)錯(cuò):Failed to parse source for import analysis because the content contains invalid JS syntax. Install @vitejs/plugin-vue to handle .vue files.
解決方法:
1)安裝 @vitejs/plugin-vue
npm i @vitejs/plugin-vue
2)重新 npm install
npm install
3)添加配置文件vite.config.js
// vite.config.js import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue()] })
4)重新運(yùn)行即可
npm run dev
3.improt引入文件報(bào)錯(cuò)
報(bào)錯(cuò):無(wú)法找到模塊“../views/HomeView.vue”的聲明文件。“/Users/lianwei/Desktop/old/PersonalProject/vite-demo2/src/views/HomeView.vue.js”隱式擁有 "any" 類(lèi)型。
解決方法:找到src/vite-env.d.ts 添加以下代碼
// 在文件中加上 declare module '*.vue' { import type { DefineComponent } from 'vue' const component: DefineComponent<{}, {}, any> export default component } // 或者 declare module '*.vue' { import type { DefineComponent } from 'vue' const component: ComponentOptions | ComponentOptions['setup'] export default component }
總結(jié)
到此這篇關(guān)于Vite使用報(bào)錯(cuò)解決方法的文章就介紹到這了,更多相關(guān)Vite使用報(bào)錯(cuò)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- vue3+vite項(xiàng)目中按需引入vant報(bào)錯(cuò):Failed?to?resolve?import的解決方案
- vite配置別名并處理報(bào)錯(cuò):找不到模塊“xxx”或其相應(yīng)的類(lèi)型聲明方法詳解
- 解決vue?vite啟動(dòng)項(xiàng)目報(bào)錯(cuò)ERROR:?Unexpected?“\x88“?in?JSON?的問(wèn)題
- vue3+vite中報(bào)錯(cuò)信息處理方法Error: Module “path“ has been externalized for browser compatibility...
- vue3+vite:src使用require動(dòng)態(tài)導(dǎo)入圖片報(bào)錯(cuò)的最新解決方法
- Vue3之Vite中由element?ui更新導(dǎo)致的啟動(dòng)報(bào)錯(cuò)解決
- Vite3 Svelte3構(gòu)建Web應(yīng)用報(bào)錯(cuò)process is not defined
相關(guān)文章
利用vue3+ts實(shí)現(xiàn)管理后臺(tái)(增刪改查)
這篇文章主要介紹了利用vue3+ts實(shí)現(xiàn)管理后臺(tái)(增刪改查),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-10-10vue項(xiàng)目中icon亂碼的問(wèn)題及解決
這篇文章主要介紹了vue項(xiàng)目中icon亂碼的問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-12-12vue中報(bào)錯(cuò)Duplicate?keys?detected:'1'.?This?may?c
我們?cè)趘ue開(kāi)發(fā)過(guò)程中常會(huì)遇到一些錯(cuò)誤,這篇文章主要給大家介紹了關(guān)于vue中報(bào)錯(cuò)Duplicate?keys?detected:‘1‘.?This?may?cause?an?update?error的解決方法,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-03-03vue3項(xiàng)目導(dǎo)入異常Error:@vitejs/PLUGIN-vue?requires?vue?(>=3.2.13
這篇文章主要給大家介紹了關(guān)于vue3項(xiàng)目導(dǎo)入異常Error:@vitejs/PLUGIN-vue?requires?vue?(>=3.2.13)的解決辦法,文中將解決辦法介紹的非常詳細(xì),需要的朋友可以參考下2024-01-01解決vue中reader.onload讀取文件的異步問(wèn)題
這篇文章主要介紹了解決vue中reader.onload讀取文件的異步問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-10-10vue實(shí)現(xiàn)百度語(yǔ)音合成的實(shí)例講解
在本篇文章里小編給大家整理的是關(guān)于vue實(shí)現(xiàn)百度語(yǔ)音合成的實(shí)例內(nèi)容,以及相關(guān)代碼,需要的朋友們參考下。2019-10-10