hexWars / hexw

🌟 A clean and minimalist Astro theme.
https://hexw.netlify.app/
MIT License
6 stars 1 forks source link

本地预览报错 #2

Open emyia2001 opened 1 month ago

emyia2001 commented 1 month ago

17:51:10 watching for file changes... 17:51:12 [200] / 12ms 17:51:13 [ERROR] [vite] Internal server error: Transform failed with 1 error: E:/astro/hexw/src/layouts/RootLayout.astro?astro&type=script&index=0&lang.ts:2:7: ERROR: Expected "(" but found "{" Plugin: vite:esbuild File: E:/astro/hexw/src/layouts/RootLayout.astro?astro&type=script&index=0&lang.ts:2:7

Expected "(" but found "{" 1 | --- 2 | import { LOCALE } from "@/config"; | ^ 3 | import { ViewTransitions } from "astro:transitions"; 4 | interface Props {

  at failureErrorWithLog (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:1651:15)
  at E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:849:29
  at responseCallbacks.<computed> (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:704:9)
  at handleIncomingPacket (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:764:9)
  at Socket.readFromStdout (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:680:7)
  at Socket.emit (node:events:519:28)
  at addChunk (node:internal/streams/readable:559:12)
  at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
  at Readable.push (node:internal/streams/readable:390:5)
  at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
  at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)

17:51:13 [ERROR] [vite] Internal server error: [postcss] E:/astro/hexw/node_modules/astro/components/ViewTransitions.astro?astro&type=sty le&index=0&lang.css:1:1: Unknown word Plugin: vite:css File: E:/astro/hexw/node_modules/astro/components/ViewTransitions.astro?astro&type=style&index=0&lang.css:1:0 1 | --- | ^ 2 | type Fallback = 'none' | 'animate' | 'swap'; 3 |
at Input.error (E:\astro\hexw\node_modules\postcss\lib\input.js:106:16) at Parser.unknownWord (E:\astro\hexw\node_modules\postcss\lib\parser.js:593:22) at Parser.other (E:\astro\hexw\node_modules\postcss\lib\parser.js:435:12) at Parser.parse (E:\astro\hexw\node_modules\postcss\lib\parser.js:470:16) at parse (E:\astro\hexw\node_modules\postcss\lib\parse.js:11:12) at new LazyResult (E:\astro\hexw\node_modules\postcss\lib\lazy-result.js:133:16) at Processor.process (E:\astro\hexw\node_modules\postcss\lib\processor.js:53:14) at compileCSS (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:32272:63) at async TransformContext.transform (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:31583:56) at async Object.transform (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:51139:30) at async loadAndTransform (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:53894:29) 17:51:13 [ERROR] [vite] Internal server error: Transform failed with 1 error: E:/astro/hexw/src/layouts/RootLayout.astro?astro&type=script&index=1&lang.ts:2:7: ERROR: Expected "(" but found "{" Plugin: vite:esbuild File: E:/astro/hexw/src/layouts/RootLayout.astro?astro&type=script&index=1&lang.ts:2:7

Expected "(" but found "{" 1 | --- 2 | import { LOCALE } from "@/config"; | ^ 3 | import { ViewTransitions } from "astro:transitions"; 4 | interface Props {

  at failureErrorWithLog (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:1651:15)
  at E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:849:29
  at responseCallbacks.<computed> (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:704:9)
  at handleIncomingPacket (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:764:9)
  at Socket.readFromStdout (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:680:7)
  at Socket.emit (node:events:519:28)
  at addChunk (node:internal/streams/readable:559:12)
  at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
  at Readable.push (node:internal/streams/readable:390:5)
  at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
  at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)

17:51:13 [ERROR] [vite] Internal server error: Transform failed with 1 error: E:/astro/hexw/node_modules/astro/components/ViewTransitions.astro?v=906590c6&astro&type=script&index=0&lang.ts:2:5: ERROR: Expect ed ";" but found "Fallback" Plugin: vite:esbuild File: E:/astro/hexw/node_modules/astro/components/ViewTransitions.astro?v=906590c6&astro&type=script&index=0&lang.ts:2:5

Expected ";" but found "Fallback" 1 | --- 2 | type Fallback = 'none' | 'animate' | 'swap'; | ^ 3 |
4 | export interface Props {

  at failureErrorWithLog (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:1651:15)
  at E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:849:29
  at responseCallbacks.<computed> (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:704:9)
  at handleIncomingPacket (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:764:9)
  at Socket.readFromStdout (E:\astro\hexw\node_modules\vite\node_modules\esbuild\lib\main.js:680:7)
  at Socket.emit (node:events:519:28)
  at addChunk (node:internal/streams/readable:559:12)
  at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
  at Readable.push (node:internal/streams/readable:390:5)
  at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
  at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)

17:51:13 [ERROR] [vite] Internal server error: [postcss] E:/astro/hexw/src/components/Moving.astro?astro&type=style&index=0&lang. css:5:1: Unknown word Plugin: vite:css File: E:/astro/hexw/src/components/Moving.astro?astro&type=style&index=0&lang.css:5:0 3 | --- 4 |
5 | <div | ^ 6 | id="movingCircle" 7 | class="w-44 h-44 pointer-events-none rounded-full bg-ring/50 z-100 blur-3xl fixed" at Input.error (E:\astro\hexw\node_modules\postcss\lib\input.js:106:16) at Parser.unknownWord (E:\astro\hexw\node_modules\postcss\lib\parser.js:593:22) at Parser.decl (E:\astro\hexw\node_modules\postcss\lib\parser.js:236:16) at Parser.other (E:\astro\hexw\node_modules\postcss\lib\parser.js:399:18) at Parser.parse (E:\astro\hexw\node_modules\postcss\lib\parser.js:470:16) at parse (E:\astro\hexw\node_modules\postcss\lib\parse.js:11:12) at new LazyResult (E:\astro\hexw\node_modules\postcss\lib\lazy-result.js:133:16) at Processor.process (E:\astro\hexw\node_modules\postcss\lib\processor.js:53:14) at compileCSS (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:32272:63) at async TransformContext.transform (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:31583:56) at async Object.transform (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:51139:30) at async loadAndTransform (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:53894:29) 17:51:13 [ERROR] [vite] Internal server error: [postcss] E:/astro/hexw/src/pages/index.astro?astro&type=style&index=0&lang.css:1: 1: Unknown word Plugin: vite:css File: E:/astro/hexw/src/pages/index.astro?astro&type=style&index=0&lang.css:1:0 1 | --- | ^ 2 | import RootLayout from "@/layouts/RootLayout.astro"; 3 | import { SocialIcons } from "@/components/SocialIcons"; at Input.error (E:\astro\hexw\node_modules\postcss\lib\input.js:106:16) at Parser.unknownWord (E:\astro\hexw\node_modules\postcss\lib\parser.js:593:22) at Parser.other (E:\astro\hexw\node_modules\postcss\lib\parser.js:435:12) at Parser.parse (E:\astro\hexw\node_modules\postcss\lib\parser.js:470:16) at parse (E:\astro\hexw\node_modules\postcss\lib\parse.js:11:12) at new LazyResult (E:\astro\hexw\node_modules\postcss\lib\lazy-result.js:133:16) at Processor.process (E:\astro\hexw\node_modules\postcss\lib\processor.js:53:14) at compileCSS (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:32272:63) at async TransformContext.transform (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:31583:56) at async Object.transform (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:51139:30) at async loadAndTransform (file:///E:/astro/hexw/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:53894:29) 17:51:13 [200] /about/ 35ms

emyia2001 commented 1 month ago

image

hexWars commented 1 month ago

你删掉原来的项目重新下载试试,会不会是npm包的下载问题

hexWars commented 1 month ago

除此之外,我希望知道你的node版本

emyia2001 commented 1 month ago

image

hexWars commented 1 month ago

很奇怪,我无法复现,你的node版本是没问题的,看起来是vite的问题?

我重新说明一下如何运行

  1. 把项目下载下来
  2. 在项目的目录里运行npm install,注意不能出现error
  3. 执行npm run dev

我依旧觉得可能是你网络问题,包没有下载完全,如果还未能解决,请再联系我

emyia2001 commented 1 month ago

image

emyia2001 commented 1 month ago

重新clone了一次还是不行,但是可以直接部署到netlify上

hexWars commented 1 month ago

我明天再看看吧

hexWars commented 1 month ago

再试一次,重新clone然后运行npm install