chatgpt-web-dev / chatgpt-web

A third-party ChatGPT Web UI page built with Express and Vue3, through the official OpenAI completion API. / 用 Express 和 Vue3 搭建的第三方 ChatGPT 前端页面, 基于 OpenAI 官方 completion API.
https://chatgpt-web.dev
MIT License
1.63k stars 442 forks source link

docker部署启动报错 #102

Open CurisZhou opened 1 year ago

CurisZhou commented 1 year ago

大佬您好,这个项目我docker部署报如下错误;而且我在service/目录下面配置好了.env文件,想咨询下大佬这个该怎么解决,感谢大佬!

chatgpt-web-service@1.0.0 prod /app esno ./build/index.js

/app/node_modules/.pnpm/mongodb-connection-string-url@2.6.0/node_modules/mongodb-connection-string-url/lib/index.js:9 return (connectionString.startsWith('mongodb://') || ^

TypeError: Cannot read properties of undefined (reading 'startsWith') at connectionStringHasValidScheme (/app/node_modules/.pnpm/mongodb-connection-string-url@2.6.0/node_modules/mongodb-connection-string-url/lib/index.js:9:30) at ConnectionString (/app/node_modules/.pnpm/mongodb-connection-string-url@2.6.0/node_modules/mongodb-connection-string-url/lib/index.js:85:34) at parseOptions (/app/node_modules/.pnpm/mongodb@5.1.0/node_modules/mongodb/lib/connection_string.js:204:17) at MongoClient (/app/node_modules/.pnpm/mongodb@5.1.0/node_modules/mongodb/lib/mongo_client.js:46:50) at __defProp (/app/build/index.js:9630:14) at Object. (/app/build/index.js:10909:1) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Object.F (/app/node_modules/.pnpm/@esbuild-kit+cjs-loader@2.4.2/node_modules/@esbuild-kit/cjs-loader/dist/index.js:1:941) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12)

Node.js v18.16.0  ELIFECYCLE  Command failed with exit code 1.

Kerwin1202 commented 1 year ago

是怎么跑得,直接命令? 可以用vs code 自带的 debug 指定变量路径

image
CurisZhou commented 1 year ago

是怎么跑得,直接命令? 可以用vs code 自带的 debug 指定变量路径

image

我是在自己的云服务器里,直接打好镜像之后,使用前台运行的命令 docker run --name chatgpt-web --rm -it -p 3002:3002 chatgpt-web 运行的,.env文件提前在service文件夹里配置好了,运行之后会报上面👆的错。

CurisZhou commented 1 year ago

@Kerwin1202 大佬好,docker部署的话,这个报错问题该怎么解决呢?

大佬您好,这个项目我docker部署报如下错误;而且我在service/目录下面配置好了.env文件,想咨询下大佬这个该怎么解决,感谢大佬!

chatgpt-web-service@1.0.0 prod /app esno ./build/index.js

/app/node_modules/.pnpm/mongodb-connection-string-url@2.6.0/node_modules/mongodb-connection-string-url/lib/index.js:9 return (connectionString.startsWith('mongodb://') || ^

TypeError: Cannot read properties of undefined (reading 'startsWith') at connectionStringHasValidScheme (/app/node_modules/.pnpm/mongodb-connection-string-url@2.6.0/node_modules/mongodb-connection-string-url/lib/index.js:9:30) at ConnectionString (/app/node_modules/.pnpm/mongodb-connection-string-url@2.6.0/node_modules/mongodb-connection-string-url/lib/index.js:85:34) at parseOptions (/app/node_modules/.pnpm/mongodb@5.1.0/node_modules/mongodb/lib/connection_string.js:204:17) at MongoClient (/app/node_modules/.pnpm/mongodb@5.1.0/node_modules/mongodb/lib/mongo_client.js:46:50) at __defProp (/app/build/index.js:9630:14) at Object. (/app/build/index.js:10909:1) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Object.F (/app/node_modules/.pnpm/@esbuild-kit+cjs-loader@2.4.2/node_modules/@esbuild-kit/cjs-loader/dist/index.js:1:941) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12)

Node.js v18.16.0  ELIFECYCLE  Command failed with exit code 1.

EvanDbg commented 1 year ago

MongoDB的容器,或者本地服务开启了么

Kerwin1202 commented 1 year ago

是怎么跑得,直接命令? 可以用vs code 自带的 debug 指定变量路径

image

我是在自己的云服务器里,直接打好镜像之后,使用前台运行的命令 docker run --name chatgpt-web --rm -it -p 3002:3002 chatgpt-web 运行的,.env文件提前在service文件夹里配置好了,运行之后会报上面👆的错。

你是自己打包的镜像,是怎么打包的, 直接在 根目录下 docker build . 还是怎么的 ,因为可能会和目录文件有关, 既然是 docker 我推荐是 弄个 docker-compose.yml 然后 修改 image 为你自己打包的 参考 https://github.com/Kerwin1202/chatgpt-web/blob/main/docker-compose/docker-compose.yml

CurisZhou commented 1 year ago

@Kerwin1202 找到问题了,感谢大佬!确实用docker-compose会更好

是怎么跑得,直接命令? 可以用vs code 自带的 debug 指定变量路径

image

我是在自己的云服务器里,直接打好镜像之后,使用前台运行的命令 docker run --name chatgpt-web --rm -it -p 3002:3002 chatgpt-web 运行的,.env文件提前在service文件夹里配置好了,运行之后会报上面👆的错。

你是自己打包的镜像,是怎么打包的, 直接在 根目录下 docker build . 还是怎么的 ,因为可能会和目录文件有关, 既然是 docker 我推荐是 弄个 docker-compose.yml 然后 修改 image 为你自己打包的 参考 https://github.com/Kerwin1202/chatgpt-web/blob/main/docker-compose/docker-compose.yml

CurisZhou commented 1 year ago

@EvanDbg 感谢大佬,确实是没开,用docker-compose应该就不会有问题😂

MongoDB的容器,或者本地服务开启了么