ivyone@ivyonedeMacBook-Pro daily-cost % npm run dev > vite-project@0.0.0 dev /Users/ivyone/hami94/daily-cost > vite > src/router/index.js:3:17: error: Could not resolve "../views/Data.vue" 3 │ import Data from "../views/Data.vue"; ? ~~~~~~~~~~~~~~~~~~~ error when starting dev server: Error: Build failed with 1 error: src/router/index.js:3:17: error: Could not resolve "../views/Data.vue" at failureErrorWithLog (/Users/ivyone/hami94/daily-cost/node_modules/esbuild/lib/main.js:1160:15) at buildResponseToResult (/Users/ivyone/hami94/daily-cost/node_modules/esbuild/lib/main.js:896:32) at /Users/ivyone/hami94/daily-cost/node_modules/esbuild/lib/main.js:991:20 at /Users/ivyone/hami94/daily-cost/node_modules/esbuild/lib/main.js:542:9 at handleIncomingPacket (/Users/ivyone/hami94/daily-cost/node_modules/esbuild/lib/main.js:631:9) at Socket.readFromStdout (/Users/ivyone/hami94/daily-cost/node_modules/esbuild/lib/main.js:509:7) at Socket.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Socket.Readable.push (internal/streams/readable.js:223:10) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! vite-project@0.0.0 dev: `vite` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the vite-project@0.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/ivyone/.npm/_logs/2021-03-12T00_05_38_519Z-debug.log ivyone@ivyonedeMacBook-Pro daily-cost % npm run dev > vite-project@0.0.0 dev /Users/ivyone/hami94/daily-cost > vite error when starting dev server: Error: The following dependencies are imported but could not be resolved: lib-flexible/flexible (imported by /Users/ivyone/hami94/daily-cost/src/main.js) Are they installed? at optimizeDeps (/Users/ivyone/hami94/daily-cost/node_modules/vite/dist/node/chunks/dep-e0f09032.js:67754:15) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async runOptimize (/Users/ivyone/hami94/daily-cost/node_modules/vite/dist/node/chunks/dep-e0f09032.js:68328:48) at async Server.httpServer.listen (/Users/ivyone/hami94/daily-cost/node_modules/vite/dist/node/chunks/dep-e0f09032.js:68342:17) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! vite-project@0.0.0 dev: `vite` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the vite-project@0.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/ivyone/.npm/_logs/2021-03-12T00_06_46_494Z-debug.log ivyone@ivyonedeMacBook-Pro daily-cost % npm install lib-flexible --save-dev npm notice save lib-flexible is being moved from dependencies to devDependencies npm WARN less-loader@8.0.0 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN vite-project@0.0.0 No description npm WARN vite-project@0.0.0 No repository field. npm WARN vite-project@0.0.0 No license field. + lib-flexible@0.3.2 added 1 package in 2.762s 5 packages are looking for funding run `npm fund` for details ivyone@ivyonedeMacBook-Pro daily-cost % npm run dev > vite-project@0.0.0 dev /Users/ivyone/hami94/daily-cost > vite Pre-bundling dependencies: vue lib-flexible/flexible vant vue-router (this will be run only when your dependencies or config have changed) vite v2.0.5 dev server running at: > Local: http://localhost:3000/ > Network: http://192.168.3.11:3000/ ready in 981ms.
解决方法:
安装lib-flexible
npm install lib-flexible --save-dev