最近通过yarn dev启动vite项目时报了下面的错:
failed to load config from F:\code\qn-test-vweb\vite.config.ts error when starting dev server: Error: Build failed with 1 error: tsconfig.json:1:0: ERROR: Unexpected "\x88" in JSON at failureErrorWithLog (F:\code\qn-test-vweb\node_modules\esbuild\lib\main.js:1566:15) at F:\code\qn-test-vweb\node_modules\esbuild\lib\main.js:1024:28 at runOnEndCallbacks (F:\code\qn-test-vweb\node_modules\esbuild\lib\main.js:1438:61) at buildResponseToResult (F:\code\qn-test-vweb\node_modules\esbuild\lib\main.js:1022:7) at F:\code\qn-test-vweb\node_modules\esbuild\lib\main.js:1134:14 at responseCallbacks.<computed> (F:\code\qn-test-vweb\node_modules\esbuild\lib\main.js:671:9) at handleIncomingPacket (F:\code\qn-test-vweb\node_modules\esbuild\lib\main.js:726:9) at Socket.readFromStdout (F:\code\qn-test-vweb\node_modules\esbuild\lib\main.js:647:7) at Socket.emit (node:events:513:28) at addChunk (node:internal/streams/readable:315:12) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
百度无果后尝试升级node、yarn、等还是无用,最后分析了文件字节码发现是公司电脑加密的原因。
在打包编译的时候由于加密无法进行编译,解决的话就得联系运维来帮忙处理了。
但如果通过yarn create vite
新建一个项目不会出现上述问题。