lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.66k stars 10.03k forks source link

[Bug] Fail in Vercel deployment: Module not found: Can't resolve 'http' #670

Closed ymansurozer closed 11 months ago

ymansurozer commented 11 months ago

💻 系统环境 | Operating System

Windows

🌐 浏览器 | Browser

Chrome

🐛 问题描述 | Bug Description

I simply clicked on the Deploy on Vercel button, added the OpenAI API Key but keep getting the below error in building: image

Full logs:

[10:14:16.023] Running build in Washington, D.C., USA (East) – iad1
[10:14:16.124] Cloning github.com/ymansurozer/lobe-chat (Branch: main, Commit: 6d19564)
[10:14:16.132] Skipping build cache, deployment was triggered without cache.
[10:14:19.365] Cloning completed: 3.242s
[10:14:19.674] Running "vercel build"
[10:14:20.182] Vercel CLI 32.7.1
[10:14:20.597] Running "install" command: `/bun1/bun install`...
[10:14:20.648] bun install v1.0.15 (b3bdf22e)
[10:14:20.663]  Resolving dependencies
[10:14:28.401]  Resolved, downloaded and extracted [8062]
[10:14:28.402] warn: incorrect peer dependency "stylelint@15.11.0"
[10:14:28.402] 
[10:14:28.402] warn: incorrect peer dependency "stylelint@15.11.0"
[10:14:28.402] 
[10:14:28.402] warn: incorrect peer dependency "@octokit/core@5.0.2"
[10:14:28.402] 
[10:14:28.402] warn: incorrect peer dependency "@octokit/core@5.0.2"
[10:14:28.641]  Saved lockfile
[10:14:31.041]  + @commitlint/cli@18.4.3
[10:14:31.041]  + @ducanh2912/next-pwa@9.7.2
[10:14:31.041]  + @lobehub/i18n-cli@1.15.1
[10:14:31.041]  + @lobehub/lint@1.21.0
[10:14:31.041]  + @next/bundle-analyzer@14.0.4
[10:14:31.041]  + @next/eslint-plugin-next@14.0.4
[10:14:31.041]  + @testing-library/jest-dom@6.1.5
[10:14:31.041]  + @testing-library/react@14.1.2
[10:14:31.042]  + @types/chroma-js@2.4.3
[10:14:31.042]  + @types/lodash@4.14.202
[10:14:31.042]  + @types/lodash-es@4.17.12
[10:14:31.042]  + @types/node@20.10.4
[10:14:31.042]  + @types/react@18.2.45
[10:14:31.042]  + @types/react-dom@18.2.17
[10:14:31.042]  + @types/semver@7.5.6
[10:14:31.042]  + @types/systemjs@6.13.5
[10:14:31.042]  + @types/ua-parser-js@0.7.39
[10:14:31.042]  + @types/uuid@9.0.7
[10:14:31.042]  + @umijs/lint@4.0.89
[10:14:31.042]  + @vitest/coverage-v8@0.34.6
[10:14:31.042]  + commitlint@18.4.3
[10:14:31.042]  + consola@3.2.3
[10:14:31.042]  + dpdm@3.14.0
[10:14:31.042]  + eslint@8.55.0
[10:14:31.042]  + fake-indexeddb@5.0.1
[10:14:31.042]  + glob@10.3.10
[10:14:31.042]  + husky@8.0.3
[10:14:31.042]  + jsdom@23.0.1
[10:14:31.042]  + lint-staged@15.2.0
[10:14:31.043]  + lodash@4.17.21
[10:14:31.043]  + markdown-table@3.0.3
[10:14:31.043]  + node-fetch@3.3.2
[10:14:31.043]  + p-map@7.0.0
[10:14:31.043]  + prettier@3.1.1
[10:14:31.043]  + remark-cli@11.0.0
[10:14:31.043]  + remark-parse@10.0.2
[10:14:31.043]  + semantic-release@21.1.2
[10:14:31.043]  + stylelint@15.11.0
[10:14:31.043]  + ts-node@10.9.2
[10:14:31.043]  + typescript@5.3.3
[10:14:31.043]  + unified@11.0.4
[10:14:31.044]  + unist-util-visit@5.0.0
[10:14:31.044]  + vitest@0.34.6
[10:14:31.044]  + @ant-design/icons@5.2.6
[10:14:31.044]  + @icons-pack/react-simple-icons@9.2.0
[10:14:31.044]  + @lobehub/chat-plugin-sdk@1.30.1
[10:14:31.044]  + @lobehub/chat-plugins-gateway@1.8.2
[10:14:31.044]  + @lobehub/tts@1.23.3
[10:14:31.044]  + @lobehub/ui@1.120.14
[10:14:31.044]  + @vercel/analytics@1.1.1
[10:14:31.044]  + ahooks@3.7.8
[10:14:31.044]  + ai@2.2.29
[10:14:31.044]  + antd@5.12.2
[10:14:31.044]  + antd-style@3.6.1
[10:14:31.044]  + brotli-wasm@1.3.1
[10:14:31.044]  + chroma-js@2.4.2
[10:14:31.045]  + copy-to-clipboard@3.3.3
[10:14:31.045]  + dayjs@1.11.10
[10:14:31.045]  + dexie@3.2.4
[10:14:31.045]  + fast-deep-equal@3.1.3
[10:14:31.045]  + gpt-tokenizer@2.1.2
[10:14:31.045]  + i18next@23.7.11
[10:14:31.045]  + i18next-browser-languagedetector@7.2.0
[10:14:31.045]  + i18next-resources-for-ts@1.4.0
[10:14:31.045]  + i18next-resources-to-backend@1.2.0
[10:14:31.045]  + idb-keyval@6.2.1
[10:14:31.045]  + immer@10.0.3
[10:14:31.046]  + lodash-es@4.17.21
[10:14:31.046]  + lucide-react@0.295.0
[10:14:31.046]  + modern-screenshot@4.4.36
[10:14:31.046]  + nanoid@5.0.4
[10:14:31.046]  + next@14.0.4
[10:14:31.046]  + openai@4.22.0
[10:14:31.046]  + polished@4.2.2
[10:14:31.046]  + posthog-js@1.96.0
[10:14:31.046]  + query-string@8.1.0
[10:14:31.046]  + react@18.2.0
[10:14:31.046]  + react-dom@18.2.0
[10:14:31.046]  + react-hotkeys-hook@4.4.1
[10:14:31.046]  + react-i18next@13.5.0
[10:14:31.047]  + react-intersection-observer@9.5.3
[10:14:31.047]  + react-layout-kit@1.7.4
[10:14:31.047]  + react-lazy-load@4.0.1
[10:14:31.047]  + react-wrap-balancer@1.1.0
[10:14:31.047]  + remark@14.0.3
[10:14:31.047]  + remark-gfm@3.0.1
[10:14:31.047]  + remark-html@15.0.2
[10:14:31.047]  + semver@7.5.4
[10:14:31.047]  + sharp@0.33.0
[10:14:31.047]  + swr@2.2.4
[10:14:31.047]  + systemjs@6.14.2
[10:14:31.047]  + ts-md5@1.3.1
[10:14:31.047]  + ua-parser-js@1.0.37
[10:14:31.047]  + url-join@5.0.0
[10:14:31.047]  + use-merge-value@1.2.0
[10:14:31.048]  + utility-types@3.10.0
[10:14:31.048]  + uuid@9.0.1
[10:14:31.048]  + zod@3.22.4
[10:14:31.048]  + zustand@4.4.7
[10:14:31.048]  + zustand-utils@1.3.1
[10:14:31.554] husky - Git hooks installed
[10:14:31.560] 
[10:14:31.560]  2172 packages installed [10.42s]
[10:14:31.601] Detected Next.js version: 14.0.4
[10:14:31.609] Running "bun run build"
[10:14:31.617] $ next build
[10:14:36.362] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[10:14:36.362] This information is used to shape Next.js' roadmap and prioritize features.
[10:14:36.362] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[10:14:36.362] https://nextjs.org/telemetry
[10:14:36.362] 
[10:14:36.473]    ▲ Next.js 14.0.4
[10:14:36.473]    - Experiments (use at your own risk):
[10:14:36.473]      · forceSwcTransforms
[10:14:36.474] 
[10:14:36.474]    Creating an optimized production build ...
[10:14:37.005]  ✓ (pwa) Compiling for server...
[10:14:37.006]  ✓ (pwa) Compiling for server...
[10:14:37.007]  ✓ (pwa) Compiling for client (static)...
[10:14:37.007]  ○ (pwa) Service worker: /vercel/path0/public/sw.js
[10:14:37.007]  ○ (pwa)   URL: /sw.js
[10:14:37.007]  ○ (pwa)   Scope: /
[10:15:49.488] Failed to compile.
[10:15:49.488] 
[10:15:49.488] ./node_modules/@apidevtools/swagger-parser/node_modules/@apidevtools/json-schema-ref-parser/lib/resolvers/http.js:3:13
[10:15:49.488] Module not found: Can't resolve 'http'
[10:15:49.489] Did you mean './http'?
[10:15:49.489] Requests that should resolve in the current directory need to start with './'.
[10:15:49.489] Requests that start with a name are treated as module requests and resolve within module directories (node_modules, /vercel/path0).
[10:15:49.489] If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
[10:15:49.489] 
[10:15:49.489] https://nextjs.org/docs/messages/module-not-found
[10:15:49.489] 
[10:15:49.489] Import trace for requested module:
[10:15:49.489] ./node_modules/@apidevtools/swagger-parser/node_modules/@apidevtools/json-schema-ref-parser/lib/options.js
[10:15:49.489] ./node_modules/@apidevtools/swagger-parser/lib/options.js
[10:15:49.489] ./node_modules/@apidevtools/swagger-parser/lib/index.js
[10:15:49.489] ./node_modules/@lobehub/chat-plugin-sdk/lib/openapi/index.js
[10:15:49.489] ./node_modules/@lobehub/chat-plugin-sdk/openapi.js
[10:15:49.489] ./node_modules/@lobehub/chat-plugins-gateway/dist/gateway.js
[10:15:49.489] ./node_modules/@lobehub/chat-plugins-gateway/dist/index.js
[10:15:49.489] ./src/app/api/plugins/route.ts
[10:15:49.490] ./node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js?absolutePagePath=private-next-app-dir%2Fapi%2Fplugins%2Froute.ts&page=%2Fapi%2Fplugins%2Froute&appDirLoader=bmV4dC1hcHAtbG9hZGVyP25hbWU9YXBwJTJGYXBpJTJGcGx1Z2lucyUyRnJvdXRlJnBhZ2U9JTJGYXBpJTJGcGx1Z2lucyUyRnJvdXRlJnBhZ2VQYXRoPXByaXZhdGUtbmV4dC1hcHAtZGlyJTJGYXBpJTJGcGx1Z2lucyUyRnJvdXRlLnRzJmFwcERpcj0lMkZ2ZXJjZWwlMkZwYXRoMCUyRnNyYyUyRmFwcCZhcHBQYXRocz0lMkZhcGklMkZwbHVnaW5zJTJGcm91dGUmcGFnZUV4dGVuc2lvbnM9dHN4JnBhZ2VFeHRlbnNpb25zPXRzJnBhZ2VFeHRlbnNpb25zPWpzeCZwYWdlRXh0ZW5zaW9ucz1qcyZiYXNlUGF0aD0mYXNzZXRQcmVmaXg9Jm5leHRDb25maWdPdXRwdXQ9JnByZWZlcnJlZFJlZ2lvbj0mbWlkZGxld2FyZUNvbmZpZz1lMzAlM0Qh&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!
[10:15:49.490] 
[10:15:49.490] ./node_modules/@apidevtools/swagger-parser/node_modules/@apidevtools/json-schema-ref-parser/lib/resolvers/http.js:4:14
[10:15:49.490] Module not found: Can't resolve 'https'
[10:15:49.490] 
[10:15:49.490] https://nextjs.org/docs/messages/module-not-found
[10:15:49.490] 
[10:15:49.490] Import trace for requested module:
[10:15:49.490] ./node_modules/@apidevtools/swagger-parser/node_modules/@apidevtools/json-schema-ref-parser/lib/options.js
[10:15:49.490] ./node_modules/@apidevtools/swagger-parser/lib/options.js
[10:15:49.490] ./node_modules/@apidevtools/swagger-parser/lib/index.js
[10:15:49.490] ./node_modules/@lobehub/chat-plugin-sdk/lib/openapi/index.js
[10:15:49.490] ./node_modules/@lobehub/chat-plugin-sdk/openapi.js
[10:15:49.490] ./node_modules/@lobehub/chat-plugins-gateway/dist/gateway.js
[10:15:49.490] ./node_modules/@lobehub/chat-plugins-gateway/dist/index.js
[10:15:49.490] ./src/app/api/plugins/route.ts
[10:15:49.490] ./node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js?absolutePagePath=private-next-app-dir%2Fapi%2Fplugins%2Froute.ts&page=%2Fapi%2Fplugins%2Froute&appDirLoader=bmV4dC1hcHAtbG9hZGVyP25hbWU9YXBwJTJGYXBpJTJGcGx1Z2lucyUyRnJvdXRlJnBhZ2U9JTJGYXBpJTJGcGx1Z2lucyUyRnJvdXRlJnBhZ2VQYXRoPXByaXZhdGUtbmV4dC1hcHAtZGlyJTJGYXBpJTJGcGx1Z2lucyUyRnJvdXRlLnRzJmFwcERpcj0lMkZ2ZXJjZWwlMkZwYXRoMCUyRnNyYyUyRmFwcCZhcHBQYXRocz0lMkZhcGklMkZwbHVnaW5zJTJGcm91dGUmcGFnZUV4dGVuc2lvbnM9dHN4JnBhZ2VFeHRlbnNpb25zPXRzJnBhZ2VFeHRlbnNpb25zPWpzeCZwYWdlRXh0ZW5zaW9ucz1qcyZiYXNlUGF0aD0mYXNzZXRQcmVmaXg9Jm5leHRDb25maWdPdXRwdXQ9JnByZWZlcnJlZFJlZ2lvbj0mbWlkZGxld2FyZUNvbmZpZz1lMzAlM0Qh&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!
[10:15:49.490] 
[10:15:49.491] 
[10:15:49.491] > Build failed because of webpack errors
[10:15:49.612] error: script "build" exited with code 1 (SIGHUP)
[10:15:49.616] Error: Command "bun run build" exited with 1
[10:15:51.117] 

🚦 期望结果 | Expected Behavior

No response

📷 复现步骤 | Recurrence Steps

No response

📝 补充信息 | Additional Information

No response

lobehubbot commented 11 months ago

👀 @ymansurozer

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

Les1ey commented 11 months ago

+1,我折腾了半小时以为是我的问题,刚准备来提issue

lobehubbot commented 11 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


+1, I struggled for half an hour thinking it was my problem, and I was just about to raise an issue.

yhwymy commented 11 months ago

+1,我折腾了半小时以为是我的问题,刚准备来提issue

俺也一样。

lobehubbot commented 11 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


+1, I struggled for half an hour thinking it was my problem, and I was just about to raise an issue.

Me too.

lobehubbot commented 11 months ago

✅ @ymansurozer

This issue is closed, If you have any questions, you can comment and reply.\ 此问题已经关闭。如果您有任何问题,可以留言并回复。

lobehubbot commented 11 months ago

:tada: This issue has been resolved in version 0.111.6 :tada:

The release is available on:

Your semantic-release bot :package::rocket: