Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicting @types/node version #3793

Closed
andrejleitner opened this issue Feb 4, 2021 · 7 comments
Closed

Conflicting @types/node version #3793

andrejleitner opened this issue Feb 4, 2021 · 7 comments
Labels
bug Something isn't working
Milestone

Comments

@andrejleitner
Copy link

Describe the bug
There is fixed version of node types defined as socket.io dependency causing conflicts.

"@types/node": "^14.14.10",

To Reproduce

  • install other version of @types/node as your dev dependency of your project (e.g. @types/node@12)
  • install socket.io@3 as original dependency of your project
  • try to compile typescript file, you will get the following error:
node_modules/socket.io/dist/client.d.ts:1:23 - error TS4090: Conflicting definitions for 'node' found at
'~/example_project/node_modules/socket.io/node_modules/@types/node/index.d.ts' and
'~/example_project/node_modules/@types/node/index.d.ts'.
Consider installing a specific version of this library to resolve the conflict.

1 /// <reference types="node" />
@andrejleitner andrejleitner added the bug Something isn't working label Feb 4, 2021
@ironicbrew
Copy link

Unable to reproduce following the above instructions, everything compiles on my end without issue even with conflicting @types/node dev dep versions in my app vs. socket io

Can you try to rm -rf node_modules and reinstall with npm i? A bungled package-lock.json might be the issue here.

If that doesn't work I'd need a repo to clone that reproduces this issue as something is key is missing from the reproduction instructions, perhaps some setting in tsconfig.json is causing the build to trip?

@andrejleitner
Copy link
Author

Hey @ironicbrew, thanks for looking at it. Before posting it here, I've tried a clean installation exactly as you suggested. It just didn't help. Btw. doesn't it make sense to have that and other @types defined as dependencies (non-dev)?

@Sumolari
Copy link

Btw. doesn't it make sense to have that and other @types defined as dependencies (non-dev)?

I was about to open a different issue about moving @types/node to devDependencies. It's a big package (around 740kb) and it should give no value on runtime.

@ironicbrew
Copy link

@andrejleitner, Are you using any additional config in your tsconfig that may be a little more strict than mine?

Only other thing I can think of is if you fork the repo and switch the troublesome dependency to a devDependency as suggested by @Sumolari and then npm install that it would be interesting to see if that resolved the issue.

@darrachequesne
Copy link
Member

@andrejleitner I could indeed reproduce, thanks.

I see two possible solutions:

This comment suggests to go for the latter.

What is your opinion on this?

@andrejleitner
Copy link
Author

Thanks @darrachequesne for checking and for the link to interesting reading too. I quite like also the latter comment, but don't have a strong opinion either.

However, the second option seems right to me, at least having this definition here:

"node": ">=10.0.0"

... and it should fix the conflict (the original issue).

@darrachequesne
Copy link
Member

Fixed by 67a61e3, included in [email protected].

@darrachequesne darrachequesne added this to the 3.1.2 milestone Feb 26, 2021
dzad pushed a commit to dzad/socket.io that referenced this issue May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants