6

Is there a way to include two versions of the same dependency in nodejs package.json?

For testing purposes, I need to use two versions of socket.io (one to expose a socket in the latest version and one to simulate a dependency server using an old release).

{ "dependencies": { "socket.io": "~0.9.0", "socket.io": "~1.2.0" } }

1 Answer 1

1

Maybe not the best solution, but you can first fork socket.io 0.9 on github: https://github.com/Automattic/socket.io/tree/0.9

To create https://github.com/youaccount/socket.io/tree/0.9

Then use this:

"dependencies": {
    "oldsocket.io": "git+ssh://[email protected]/socket.io.git#0.9",
    "socket.io": "~1.2.0"
}

Edit the package.json and rename the name attribute to oldsocket.io

And you can now require socket.io or oldsocket.io

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.