Search code examples
node.jsnpmamazon-dynamodbnpm-installloopbackjs

How do I install correct NPM package when two packages have the same name?


I'm trying to connect Loopback3 to DynamoDB, and thus am looking to install a connector. This one -- https://github.com/codecaptainadmin/loopback-connector-dynamodb/blob/master/README.md -- seemed good because it has instructions, as opposed to this one -- https://github.com/mandarzope/loopback-connector-dynamodb#readme. But they both seem to have the same NPM name. That is, the first says to:

$ npm install loopback-connector-dynamodb --save

but this seems to be installing the second one. From my package.json:

    "loopback-connector-dynamodb": "0.1.0-5",

(0.1.0-5 is the version number of the one I don't want). How do I differentiate when I install the packages?

(On a parenthetical note, if someone recommends one over the other, or an entirely different package or manner to connect Loopback3 to DynamoDB, I'd welcome the recommendation)


Solution

  • The answer to the question asked in your post is to prefix the package name with the relevant scope, e.g. @letscomunica/loopback-connector-dynamodb seems to be another path to the one you installed by mandarzope. You can find the scope by doing a search on the NPM registry. See also the npm docs on scope.

    However, your question points to a repository by codecaptainadmin which appears to not actually be published on NPM - I would think twice about using it if they're confused about how to do that and not accepting issues.

    If you want one contained in the github repository belonging to codecaptainadmin, you can specify a git-sourced install like this: npm install codecaptainadmin/loopback-connector-dynamodb

    Refer to the npm docs for usage details on the above two formats.