underfin / vite-plugin-vue2

Vue2 plugin for Vite
621 stars 84 forks source link

vite2 + vue2 + ts start dev fail #123

Closed yufan-zhao closed 3 years ago

yufan-zhao commented 3 years ago

Description

I cannot stat dev server and don't know how to do.

Version info

vite: "^2.4.2" vite-plugin-vue2: "^1.7.3"

Env info

windows10 + VSCode

Node script

node node_modules/esbuild/install.js && vite --force

Console info

$ node node_modules/esbuild/install.js && vite --force
failed to load config from D:\my-web-demo\vite.config.ts
error when starting dev server:
Error: Cannot find module './declaration'
Require stack:
- D:\my-web-demo\node_modules\@vue\component-compiler-utils\node_modules\postcss\lib\postcss.js
- D:\my-web-demo\node_modules\@vue\component-compiler-utils\dist\compileStyle.js
- D:\my-web-demo\node_modules\@vue\component-compiler-utils\dist\index.js
- D:\my-web-demo\node_modules\vite-plugin-vue2\dist\utils\descriptorCache.js
- D:\my-web-demo\node_modules\vite-plugin-vue2\dist\main.js
- D:\my-web-demo\node_modules\vite-plugin-vue2\dist\index.js
- D:\my-web-demo\vite.config.ts
- D:\my-web-demo\node_modules\vite\dist\node\chunks\dep-11db14da.js
- D:\my-web-demo\node_modules\vite\dist\node\cli.js
- D:\my-web-demo\node_modules\vite\bin\vite.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (D:\my-web-demo\node_modules\@vue\component-compiler-utils\node_modules\postcss\lib\postcss.js:6:43)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (D:\my-web-demo\node_modules\@vue\component-compiler-utils\dist\compileStyle.js:7:17)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Error info

image

yufan-zhao commented 3 years ago

After use npm install instead of yarn Everything ok.

And clean yarn cache. Also ok.