babaohuang / GeminiProChat

Minimal web UI for GeminiPro.
https://geminiprochat.com
MIT License
4.2k stars 12.33k forks source link

用最新pnpm組件self-deploying發生錯誤 #161

Closed codenamedpkt closed 2 months ago

codenamedpkt commented 2 months ago

How is Gemini Pro Chat deployed?

Others (Specify in description)

Describe the bug

用最新版NODE.js、npm組件和pnpm組件,行run build,不論本地、Vercel和Netlify均失敗,發生錯誤。

Console Logs

$ pnpm run build
> chatgpt-api-demo@0.0.1 build /data/data/com.termux/files/home/GeminiProChat
> astro build

12:21:42 PM [content] No content directory found. Skipping type generation.
12:21:42 PM [build] output target: server
12:21:42 PM [build] deploy adapter: @astrojs/node
12:21:42 PM [build] Collecting build info...
12:21:42 PM [build] Completed in 1.03s.
12:21:42 PM [build] Building server entrypoints...
12:21:51 PM [build] Completed in 9.10s.

 building client
node_modules/.pnpm/js-sha256@0.9.0/node_modules/js-sha256/src/sha256.js (83:17) Use of eval in "node_modules/.pnpm/js-sha256@0.9.0/node_modules/js-sha256/src/sha256.js" is strongly discouraged as it poses security risks and may cause issues with minification.
node_modules/.pnpm/js-sha256@0.9.0/node_modules/js-sha256/src/sha256.js (84:17) Use of eval in "node_modules/.pnpm/js-sha256@0.9.0/node_modules/js-sha256/src/sha256.js" is strongly discouraged as it poses security risks and may cause issues with minification.
src/components/MessageItem.tsx (6:9) Error when using sourcemap for reporting an error: Can't resolve original location of error.
[vite-plugin-pwa:build] "setProperty" is not exported by "node_modules/.pnpm/solid-js@1.7.6/node_modules/solid-js/web/dist/web.js", imported by "src/components/MessageItem.tsx".
file: /data/data/com.termux/files/home/GeminiProChat/src/components/MessageItem.tsx:6:9
4: import { createComponent as _$createComponent } from "solid-js/web";
5: import { addEventListener as _$addEventListener } from "solid-js/web";
6: import { setProperty as _$setProperty } from "solid-js/web";
            ^
7: import { className as _$className } from "solid-js/web";
8: import { effect as _$effect } from "solid-js/web";
 error   "setProperty" is not exported by "node_modules/.pnpm/solid-js@1.7.6/node_modules/solid-js/web/dist/web.js", imported by "src/components/MessageItem.tsx".
  File:
    /data/data/com.termux/files/home/GeminiProChat/src/components/MessageItem.tsx:6:9
  Code:
    4: import { createComponent as _$createComponent } from "solid-js/web";
    5: import { addEventListener as _$addEventListener } from "solid-js/web";
    6: import { setProperty as _$setProperty } from "solid-js/web";
                ^
    7: import { className as _$className } from "solid-js/web";
    8: import { effect as _$effect } from "solid-js/web";
  Stacktrace:
RollupError: "setProperty" is not exported by "node_modules/.pnpm/solid-js@1.7.6/node_modules/solid-js/web/dist/web.js", imported by "src/components/MessageItem.tsx".
    at error (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:2287:30)
    at Module.error (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:13745:16)
    at Module.traceVariable (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:14175:29)
    at ModuleScope.findVariable (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:12615:39)
    at ReturnValueScope.findVariable (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
    at ChildScope.findVariable (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
    at ReturnValueScope.findVariable (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
    at ChildScope.findVariable (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
    at ReturnValueScope.findVariable (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
    at ChildScope.findVariable (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
    at Identifier.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:8319:40)
    at CallExpression.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at CallExpression.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:9890:15)
    at LogicalExpression.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at ExpressionStatement.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at BlockStatement.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5888:28)
    at ArrowFunctionExpression.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at CallExpression.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5888:28)
    at CallExpression.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:9890:15)
    at ExpressionStatement.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at BlockStatement.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5888:28)
    at ArrowFunctionExpression.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at CallExpression.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at CallExpression.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:9890:15)
    at ReturnStatement.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at BlockStatement.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5888:28)
    at ArrowFunctionExpression.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at ExportDefaultDeclaration.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at Program.bind (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:5888:28)
    at Module.bindReferences (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:13741:18)
    at Graph.sortModules (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:25853:20)
    at Graph.build (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:25737:14)
    at async file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:26706:13
    at async catchUnfinishedHookActions (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:25910:16)
    at async rollupInternal (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/es/shared/node-entry.js:26701:5)
    at async Module.build (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/vite@4.5.3_@types+node@20.12.7_terser@5.30.4/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:48079:18)
    at async clientBuild (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/astro@2.10.15_@types+node@20.12.7_terser@5.30.4/node_modules/astro/dist/core/build/static-build.js:223:23)
    at async viteBuild (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/astro@2.10.15_@types+node@20.12.7_terser@5.30.4/node_modules/astro/dist/core/build/static-build.js:72:24)
    at async AstroBuilder.build (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/astro@2.10.15_@types+node@20.12.7_terser@5.30.4/node_modules/astro/dist/core/build/index.js:120:27)
    at async AstroBuilder.run (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/astro@2.10.15_@types+node@20.12.7_terser@5.30.4/node_modules/astro/dist/core/build/index.js:152:7)
    at async build (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/astro@2.10.15_@types+node@20.12.7_terser@5.30.4/node_modules/astro/dist/core/build/index.js:37:3)
    at async build (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/astro@2.10.15_@types+node@20.12.7_terser@5.30.4/node_modules/astro/dist/cli/build/index.js:20:3)
    at async runCommand (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/astro@2.10.15_@types+node@20.12.7_terser@5.30.4/node_modules/astro/dist/cli/index.js:110:7)
    at async cli (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/astro@2.10.15_@types+node@20.12.7_terser@5.30.4/node_modules/astro/dist/cli/index.js:148:5)

 ELIFECYCLE  Command failed with exit code 1.

Participation

codenamedpkt commented 2 months ago

更新: 執行pnpm I && pnpm up -L && pnpm run dev時,出現無法加載Astro設定檔案錯誤。

輸出日誌:

$ pnpm i && pnpm up -L && pnpm run build
WARN  This project is configured to use v7.28.0 of pnpm. Your current pnpm is v9.0.6
Lockfile is up to date, resolution step is skipped
Already up to date
Done in 2.9s
 WARN  This project is configured to use v7.28.0 of pnpm. Your current pnpm is v9.0.6
 WARN  1 deprecated subdependencies found: sourcemap-codec@1.4.8
Packages: +273 -269
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------
Progress: resolved 1119, reused 1040, downloaded 0, added 271, done

dependencies:
- @astrojs/netlify 2.3.0
+ @astrojs/netlify 5.2.0
- @astrojs/node 5.3.6
+ @astrojs/node 8.2.5
- @astrojs/solid-js 2.2.1
+ @astrojs/solid-js 4.1.0
- @astrojs/vercel 3.8.2
+ @astrojs/vercel 7.5.4
- @fuyun/generative-ai 0.1.3
+ @fuyun/generative-ai 0.3.1
- @zag-js/slider 0.16.0
+ @zag-js/slider 0.48.0
- @zag-js/solid 0.16.0
+ @zag-js/solid 0.48.0
- astro 2.10.15
+ astro 4.7.0
- eslint 8.57.0
+ eslint 9.1.1
- js-sha256 0.9.0
+ js-sha256 0.11.0
- markdown-it 13.0.2
+ markdown-it 14.1.0
- solid-js 1.7.6
+ solid-js 1.8.17
- undici 5.28.4
+ undici 6.14.1

devDependencies:
- @types/markdown-it 12.2.3
+ @types/markdown-it 14.0.1
- @typescript-eslint/parser 5.62.0
+ @typescript-eslint/parser 7.7.1
- @vite-pwa/astro 0.1.6
+ @vite-pwa/astro 0.3.1
- eslint-plugin-astro 0.27.2
+ eslint-plugin-astro 1.0.3
- unocss 0.50.8
+ unocss 0.59.4

 WARN  Issues with peer dependencies found
.
├─┬ @evan-yang/eslint-config 1.0.9
│ ├── ✕ unmet peer eslint@^8.0.0: found 9.1.1
│ └─┬ @evan-yang/eslint-plugin 1.0.9
│   ├── ✕ unmet peer eslint@^8.0.0: found 9.1.1
│   ├─┬ @typescript-eslint/eslint-plugin 5.62.0
│   │ ├── ✕ unmet peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0": found 9.1.1
│   │ └─┬ @typescript-eslint/type-utils 5.62.0
│   │   └─┬ @typescript-eslint/utils 5.62.0
│   │     └── ✕ unmet peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0": found 9.1.1
│   ├─┬ @typescript-eslint/parser 5.62.0
│   │ └── ✕ unmet peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0": found 9.1.1
│   ├─┬ eslint-config-standard 17.1.0
│   │ └── ✕ unmet peer eslint@^8.0.1: found 9.1.1
│   ├─┬ eslint-plugin-import 2.29.1
│   │ ├── ✕ unmet peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8": found 9.1.1
│   │ └── ✕ unmet peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8": found 9.1.1
│   ├─┬ eslint-plugin-jsx-a11y 6.8.0
│   │ └── ✕ unmet peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8": found 9.1.1
│   ├─┬ eslint-plugin-promise 6.1.1
│   │ └── ✕ unmet peer eslint@"^7.0.0 || ^8.0.0": found 9.1.1
│   ├─┬ eslint-plugin-react 7.34.1
│   │ └── ✕ unmet peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8": found 9.1.1
│   ├─┬ eslint-plugin-react-hooks 4.6.2
│   │ └── ✕ unmet peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0": found 9.1.1
│   └─┬ eslint-plugin-vue 8.7.1
│     └── ✕ unmet peer eslint@"^6.2.0 || ^7.0.0 || ^8.0.0": found 9.1.1
└─┬ @typescript-eslint/parser 7.7.1
  └── ✕ unmet peer eslint@^8.56.0: found 9.1.1

Done in 34.9s
 WARN  This project is configured to use v7.28.0 of pnpm. Your current pnpm is v9.0.6

> chatgpt-api-demo@0.0.1 build /data/data/com.termux/files/home/GeminiProChat
> astro build

[astro] Unable to load your Astro config

Missing "./edge" specifier in "@astrojs/vercel" package
  Stack trace:
    at e (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/vite@5.2.10_@types+node@20.12.7_terser@5.30.4/node_modules/vite/dist/node/chunks/dep-DkOS1hkm.js:47596:25)
    at o (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/vite@5.2.10_@types+node@20.12.7_terser@5.30.4/node_modules/vite/dist/node/chunks/dep-DkOS1hkm.js:47596:1297)
    at resolveDeepImport (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/vite@5.2.10_@types+node@20.12.7_terser@5.30.4/node_modules/vite/dist/node/chunks/dep-DkOS1hkm.js:48305:31)
    at Context.resolveId (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/vite@5.2.10_@types+node@20.12.7_terser@5.30.4/node_modules/vite/dist/node/chunks/dep-DkOS1hkm.js:47780:28)
    at async TransformContext.resolve (file:///data/data/com.termux/files/home/GeminiProChat/node_modules/.pnpm/vite@5.2.10_@types+node@20.12.7_terser@5.30.4/node_modules/vite/dist/node/chunks/dep-DkOS1hkm.js:50748:23)
 ELIFECYCLE  Command failed with exit code 1.
babaohuang commented 2 months ago

用docker或者vercel的方式部署试试。