Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker部署启动报错 #102

Open
CurisZhou opened this issue May 5, 2023 · 7 comments
Open

docker部署启动报错 #102

CurisZhou opened this issue May 5, 2023 · 7 comments

Comments

@CurisZhou
Copy link

大佬您好,这个项目我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
Copy link
Member

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

image

@CurisZhou
Copy link
Author

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

image

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

@CurisZhou
Copy link
Author

@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
Copy link

EvanDbg commented May 6, 2023

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

@Kerwin1202
Copy link
Member

是怎么跑得,直接命令? 可以用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
Copy link
Author

@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
Copy link
Author

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants