Reputation: 53
I'm trying to work with websockets on Nestjs, i install the dependencies
yarn add @nestjs/websockets @nestjs/platform-socket.io
I generated a example resource for the websockets
nest g res messagesWs --no-spec
Then this message shows up in my terminal
TypeError: this.metadataScanner.getAllMethodNames is not a function
This is a capture from the problem
What can i do? PD: sorry for my bad english
I search for that function getAllMethodNames but i didn't get anything
Upvotes: 5
Views: 7070
Reputation: 1
Work for me:
Get @nestjs/core
version in pnpm-lock.yaml
Then install @nestjs/platform-socket.io
and @nestjs/websockets
as same version of @nestjs/core
Or upgrade all packages about nestjs to latest, pnpm up
Upvotes: 0
Reputation: 9168
@nestjs/core
and @nestjs/websockets
versions should always be in sync. For example, if the latest version of your locally installed @nestjs/websockets
package is 9.3.6, then you have to make sure that @nestjs/core
is also on 9.3.6.
Once you fix this up, the error will go away.
Upvotes: 17
Reputation: 11
I back to v.
"@nestjs/platform-socket.io": "^7.6.15",
"@nestjs/websockets": "^7.6.15",
is working
Upvotes: 1
Reputation: 299
I had the same problem. I solved it by downgrading a few versions.
From
"@nestjs/platform-socket.io": "9.3.6", "@nestjs/websockets": "9.3.6"
to
"@nestjs/platform-socket.io": "9.1.6", "@nestjs/websockets": "9.1.6"
Upvotes: 11
Reputation: 91
It wokrs for me follow these steps:
node_modules
folderpackage.json
remove ^
before the version numberUpvotes: 1