Cannot find module 'socket.io' or its corresponding type declarations

Hi guys,

I tried to deploy my third project and the second project which includes ‘socket io’.
(i emitted the ‘.’ because render thinks it’s a link)
For some unknown reason i get this error when deploting: …/backend/src/types.ts(1,48): error TS2307: Cannot find module ‘socket io’ or its corresponding type declarations.

I have no idea what went wrong, everything works fine in my machine.
I might have a beginner issue but I have no figure it out yet.
Would appreciate if some one from you can help me.

this is my github project: GitHub - danieliyahu1/pokemon-memory-game

build command: cd frontend && npm install && npm run build && cd …/backend && npm install && npm run build

package.json: {
“name”: “backend”,
“version”: “1.0.0”,
“description”: “”,
“main”: “./src/index.ts”,
“scripts”: {
“dev”: “nodemon”,
“build”: “npm install && npx tsc”,
“start”: “node ./dist/index.js”
},
“author”: “”,
“license”: “ISC”,
“dependencies”: {
“cloudinary”: “^2.4.0”,
“cors”: “^2.8.5”,
“dotenv”: “^16.4.5”,
“express”: “^4.19.2”,
“http”: “^0.0.1-security”,
“mongodb”: “^6.8.0”,
“mongoose”: “^8.5.4”,
“socket io”: “^4.7.5”
},
“devDependencies”: {
“@types/cors”: “^2.8.17”,
“@types/express”: “^4.17.21”,
“@types/node”: “^22.5.0”,
“@types/socket.io”: “^3.0.2”,
“nodemon”: “^3.1.4”,
“ts-node”: “^10.9.2”,
“typescript”: “^5.5.4”
}
}

Hey,

Have you checked that socket.io is actually being installed in your environment? You can increase the verbosity level of npm to verify that each package is being installed as expected. Here’s a helpful link for more information: https://stackoverflow.com/questions/39412424/how-to-see-logs-from-npm-installation.

Jérémy.
Render Support, UTC+3

1 Like

Sure, but can you confirm if socket.io is actually being installed on this service? That’s why I suggested increasing the verbosity of npm to check that.

Are your two projects different? What are the differences? It looks like you’re navigating into different directories here—are both directories getting their own node_modules folders?

Jérémy.
Render Support, UTC+3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.