backstopmedia / nest-book-example

70 stars 35 forks source link

Error on starting project #25

Closed 73nko closed 5 years ago

73nko commented 5 years ago

Hi,

I've started with the book and when I tried to run the project by first time with the command docker-compose up I'm having a typescript compile error with this stack message:

TSError: ⨯ Unable to compile TypeScript: api_1 | src/shared/middlewares/authentication.gateway.middleware.ts(2,10): error TS2305: Module '"/app/node_modules/@nestjs/websockets/index"' has no exported member 'GatewayMiddleware'. api_1 |

I attach a image with the full console log:

captura de pantalla 2019-02-05 a las 21 25 29

I'm not sure if it's something I'm doing wrong or just a breaking change with the nest api.

Regards.

yharaskrik commented 5 years ago

Hey @73nko, it could be a breaking change in Nest, the best way to test that out would be to go into your package.json file and instead of having the hat ^ in front of the version numbers for the @nestjs scoped packages, lock them to the version in the package.json file by removing the ^, then yarn install and rerun docker compose up.

adrien2p commented 5 years ago

In the newest version you can achieve the same result by using an authguard and switchToWs context. or if your using socketio you can create an adapter that extends ioAdapter and then using server.use(middleware) that take socket, next as parameters ;)

Just an information

raedwa01 commented 5 years ago

In the newest version you can achieve the same result by using an authguard and switchToWs context. or if your using socketio you can create an adapter that extends ioAdapter and then using server.use(middleware) that take socket, next as parameters ;)

Just an information

Keep in mind many users are coming to this site having never used NEST before. I have no idea how to implement the changes you suggested having just started reading the book. I changed the package.json, rebuilt and still get the error above. I tried running locally instead of docker and get an UnhandledPromiseRejectionWarning and it won't run there.

adrien2p commented 5 years ago

Hey @raedwa01 first of all, i am sorry :)

could you get the latest version of the repo just pushed and try it again 👍

If you don't use docker, you will have to start your database and rabbitmq server (https://www.rabbitmq.com/install-homebrew.html)

raedwa01 commented 5 years ago

That took care of it. Thanks for the quick response!

adrien2p commented 5 years ago

My pleasure i try to be fast as i can :)