我正在前端文件夹中尝试Npm run dev,但出现错误
PS C:\Users\PICHAU\AppData\Local\Packages\CanonicalGroupLimited。UbuntuonDows_79rhkp1findgsc\LocalState\rootfs\home\viceek\ProjetoI\frontfront>npm运行dev
front-end@0.0.0devvite
无法从C:\Users\PICHAU\AppData\Local\Packages\CanonicalGroupLimited加载配置。UbuntuonDows_79rhkp1findgsc\LocalState\rootfs\home\viceek\ProjetoI\frontive\vite.config.ts启动dev服务器时出错:错误[ERR_MODULE_NOT_FOUND]:找不到从C:\Users\PICHAU\AppData\Local\Packages\CanonicalGroupLimited导入的包"vite"。UbuntuonDows_79rhkp1findgsc\LocalState\rootfs\home\viceek\ProjetoI\frontfront\vite.config.ts.timestamp-16654725237.mjs在新的NodeError(节点:内部/错误:393:5(在packageResolve(节点:internal/modules/esm/resolve:860:9(在moduleReve(节点:internal/modules/esm/resolve:909:20(在defaultResolve(节点:internal/modules/esm/resole:1124:11(在nextResolve(节点:internal/modules/esm/loader:163:28(在ESMLoader.resolve(节点:internal/modules/esm/loader:837:30(在ESMLoader.getModuleJob(节点:internal/modules/esm/loader:424:18(ModuleWrap。(节点:internal/modules/esm/module_job:76:40(在链路(节点:internal/modules/esm/module_job:75:36(
我的vite.config.ts文件夹:i
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()]
})```
检查是否安装了所有依赖项,如react和react dom
刚运行:-
用于npm
npm install react react-dom
用于纱线
yarn add react react-dom