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

Served socket.io client does not find client installed in own node_modules #3555

Closed
1 of 2 tasks
Apollon77 opened this issue Feb 21, 2020 · 1 comment
Closed
1 of 2 tasks
Milestone

Comments

@Apollon77
Copy link

Apollon77 commented Feb 21, 2020

You want to:

  • report a bug
  • request a feature

Current behaviour

Sometimes other socket.io-client files are served, pot. very old and so incompatible versions.

Steps to reproduce (if the current behaviour is a bug)

When it happens that e.g. an other version of socket.io-client is installed in the "root" node_modues and so the socket.io dependencies are installed in it own node_modules the current code logic in https://github.com/socketio/socket.io/blob/master/lib/index.js#L109 will not be able to find it because it only searches "to the top".
It will never find a client installed in node-modules/socket.io/node_modules/socket.io-client/... when there is a client package existing in npm structure „more above“

Expected behaviour

Find the correct version, so start searching on it's own node_modules. I woud completely switch to use requirer.resolve

Setup

  • OS: irrelevant
  • browser: multipe/irrelevant
  • socket.io version: 2.3.0

Other information (e.g. stacktraces, related issues, suggestions how to fix)

Idea for fix: see "Steps to reproduce".

I could also provide a PR if it has a chance to be adopted.

Apollon77 added a commit to Apollon77/socket.io that referenced this issue Feb 23, 2020
The old logic missed some places and was not able to look into the node_modules of the socket.io library itself.

The new logic always uses require.resolve to lookup the "correct" location for the socker.io-client library and then construct the path correctly

This fixes socketio#3555 

A fast release of a fixed version would be awesome!
dasilvacontin added a commit to dasilvacontin/socket.io that referenced this issue May 24, 2020
dasilvacontin added a commit to dasilvacontin/socket.io that referenced this issue May 24, 2020
dasilvacontin pushed a commit to dasilvacontin/socket.io that referenced this issue May 24, 2020
The old logic missed some places and was not able to look into the node_modules of the socket.io library itself.

The new logic always uses require.resolve to lookup the "correct" location for the socker.io-client library and then construct the path correctly

This fixes socketio#3555 

A fast release of a fixed version would be awesome!
@darrachequesne
Copy link
Member

For future readers: this was fixed by 7603da7, included in socket.io@3.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants