trevorblades / sorrento

💈 Website for a Vancouver barbershop
https://sorrentobarbers.com
10 stars 1 forks source link

Unable to start the API's #47

Open dep1engenharia opened 1 year ago

dep1engenharia commented 1 year ago

Hello dear Trevor,

I'm having some problems to make this project work. I tried like 10 fresh installs and I'm always facing problems related with the missing file jsonwebtoken.d.ts.

Can you help me with this?

Can you provide more information about the instalation?

I tried with both yarn and npm install, personaly I prefere to use npm install.

I created a .env file; JWT_SECRET=mysecretkey TWILIO_ACCOUNT_SID=youraccountsid TWILIO_AUTH_TOKEN=yourauthtoken

I have successfuly launch a lot of projects this is the first I'm geting issues. And this is the first I do want to have ahaha

I hope o can help me. Thank you :)

trevorblades commented 1 year ago

Hey there! This project uses yarn v1, so if you want to try running it locally, you should use yarn. That being said, I open sourced this repo just for transparency and didn't actually expect anyone else to try to run it.

But if you do want to get the API running, you need to set up a few things:

What does your installation error look like? Could you copy/paste it here?

dep1engenharia commented 1 year ago

Hello again :)

This is a cool project, why not give it a try? :)

ERROR: dep1@dep1-VirtualBox:~/Downloads/sorrento-main/api$ yarn start yarn run v1.22.19 warning package.json: No license field warning ../package.json: No license field $ nodemon -r dotenv/config --loader ts-node/esm --experimental-specifier-resolution node src [nodemon] 3.0.1 [nodemon] to restart at any time, enter rs [nodemon] watching path(s): . [nodemon] watching extensions: js,mjs,cjs,json [nodemon] starting node -r dotenv/config --loader ts-node/esm --experimental-specifier-resolution node src (node:74592) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time (Use node --trace-warnings ... to show where the warning was created) (node:74592) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time. /home/dep1/Downloads/sorrento-main/api/node_modules/ts-node/src/index.ts:859 return new TSError(diagnosticText, diagnosticCodes, diagnostics); ^ **TSError: ⨯ Unable to compile TypeScript: src/resolvers.ts:14:27 - error TS2307: Cannot find module './generated/graphql.js' or its corresponding type declarations.

14 import { Resolvers } from "./generated/graphql.js";**


src/resolvers.ts:36:10 - error TS7006: Parameter '_' implicitly has an 'any' type.

36     me: (_, __, { user }) => user,
            ~
src/resolvers.ts:36:13 - error TS7006: Parameter '__' implicitly has an 'any' type.

36     me: (_, __, { user }) => user,

MORE ERRORS:

dep1@dep1-VirtualBox:~/Downloads/sorrento-main/api$ yarn start
yarn run v1.22.19
warning package.json: No license field
warning ../package.json: No license field
$ nodemon -r dotenv/config --loader ts-node/esm --experimental-specifier-resolution node src
[nodemon] 3.0.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting `node -r dotenv/config --loader ts-node/esm --experimental-specifier-resolution node src`
(node:76163) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:76163) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
/home/dep1/Downloads/sorrento-main/api/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
**src/index.ts:21:32 - error TS7016: Could not find a declaration file for module 'jsonwebtoken'. '/home/dep1/Downloads/sorrento-main/api/node_modules/jsonwebtoken/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/jsonwebtoken` if it exists or add a new declaration (.d.ts) file containing `declare module 'jsonwebtoken';`

21 import { default as jwt } from "jsonwebtoken";**

########################################################################################
I have a postgres database runing on docker:

Here my .env file:
NEXT_PUBLIC_API_URL=http://localhost:4000/graphql
NEXT_PUBLIC_WS_URL=ws://localhost:4000/graphql
DATABASE_URL=postgres://youruser:yourpassword@localhost:5432/yourdb
PORT=3000

I'm using chat gpt to help me set this thing up but even that way i couldn't get it.
I'm also using linux(Ubuntu)
trevorblades commented 1 year ago

Oh I see. You're missing the generated GraphQL files (generated/graphql.js) which are created by GraphQL codegen. You'll need to run yarn gql before starting the server.

What do you plan on doing with this project once you have it set up?

dep1engenharia commented 1 year ago

I'll try to install the GraphQL files again carefully.

I don't know what I will do with the project but I know two things

1 - With this project I will not be the next Sam Altman or Mark Zuckerberg down the road ehehe 2 - I can even compile the project xD