cogentapps / chat-with-gpt

An open-source ChatGPT app with a voice
https://www.chatwithgpt.ai
MIT License
2.31k stars 493 forks source link

TSError: Unable to compile TypeScript #22

Closed micallb closed 1 year ago

micallb commented 1 year ago

Running 'docker-compose up' yields the below:

⠿ Container chat-with-gpt-app-1 Created 0.0s Attaching to chat-with-gpt-app-1 chat-with-gpt-app-1 | chat-with-gpt-app-1 | > Chat with GPT Server@0.2.0 start chat-with-gpt-app-1 | > npx ts-node src/index.ts chat-with-gpt-app-1 | chat-with-gpt-app-1 | /app/node_modules/ts-node/src/index.ts:859 chat-with-gpt-app-1 | return new TSError(diagnosticText, diagnosticCodes, diagnostics); chat-with-gpt-app-1 | ^ chat-with-gpt-app-1 | TSError: ⨯ Unable to compile TypeScript: chat-with-gpt-app-1 | src/database/sqlite.ts(86,25): error TS2698: Spread types may only be created from object types. chat-with-gpt-app-1 | src/database/sqlite.ts(87,51): error TS18046: 'row' is of type 'unknown'. chat-with-gpt-app-1 | src/database/sqlite.ts(88,43): error TS18046: 'row' is of type 'unknown'. chat-with-gpt-app-1 | src/database/sqlite.ts(118,25): error TS18046: 'row' is of type 'unknown'. chat-with-gpt-app-1 | src/database/sqlite.ts(118,47): error TS18046: 'row' is of type 'unknown'. chat-with-gpt-app-1 | chat-with-gpt-app-1 | at createTSError (/app/node_modules/ts-node/src/index.ts:859:12) chat-with-gpt-app-1 | at reportTSError (/app/node_modules/ts-node/src/index.ts:863:19) chat-with-gpt-app-1 | at getOutput (/app/node_modules/ts-node/src/index.ts:1077:36) chat-with-gpt-app-1 | at Object.compile (/app/node_modules/ts-node/src/index.ts:1433:41) chat-with-gpt-app-1 | at Module.m._compile (/app/node_modules/ts-node/src/index.ts:1617:30) chat-with-gpt-app-1 | at Module._extensions..js (node:internal/modules/cjs/loader:1245:10) chat-with-gpt-app-1 | at Object.require.extensions. [as .ts] (/app/node_modules/ts-node/src/index.ts:1621:12) chat-with-gpt-app-1 | at Module.load (node:internal/modules/cjs/loader:1069:32) chat-with-gpt-app-1 | at Function.Module._load (node:internal/modules/cjs/loader:904:12) chat-with-gpt-app-1 | at Module.require (node:internal/modules/cjs/loader:1093:19) { chat-with-gpt-app-1 | diagnosticCodes: [ 2698, 18046, 18046, 18046, 18046 ] chat-with-gpt-app-1 | } chat-with-gpt-app-1 exited with code 1

vasilevich commented 1 year ago

Getting the same, I think you guys should properly test your docker before going up on reddit.

mptx1024 commented 1 year ago

Changing src/database/sqlite.ts line 80 variable row to row: any to explicitly narrow it down seems to solve this. but another ts issue would come up after

raflisboa commented 1 year ago

Same error here.

icemunk commented 1 year ago

Same error

icemunk commented 1 year ago

Ok, I think I figured it out on my end here - so, line 86 in the sqlite.ts file that mentions the error. Change the line "...row" to "row:row" - to ensure it is a declared object type. It fixed this error on my end.

cogentapps commented 1 year ago

Fixed:

git pull docker-compose up —build

to rebuild your docker containers.

I’ve added a Github Action job to catch errors like this in the future.

micallb commented 1 year ago

@cogentapps, getting the same error with both @icemunk's and your solutions.

cogentapps commented 1 year ago

Can you try a fresh git clone in a new folder?

I think the old code is getting cached somewhere, because it works on a fresh install in GA.

micallb commented 1 year ago

Sorry, should have specified at the time of my last post that I had tried that already. Just tried it again to double-check and receiving the same error.

cogentapps commented 1 year ago

OK, I’ll try to reproduce the issue and figure out what’s going on.

Are you running this on a Mac?

micallb commented 1 year ago

Appreciate it! Yes, an M1 with Ventura 13.0.1

gorfreed commented 1 year ago

I am having the same issue and I am trying to deploy it on a Ubuntu 20.04 server. I tried with a fresh Git clone from today, same result.

cogentapps commented 1 year ago

Thanks to https://github.com/cogentapps/chat-with-gpt/pull/30, you can now run a pre-built Docker image:

docker run -v $(pwd)/data:/app/data -p 3000:3000 ghcr.io/cogentapps/chat-with-gpt:release

Would one of you be able to test this and see if it solves the issue?

micallb commented 1 year ago

Works great!