I can successfully query meta information for a specific version of a specific NPM package like this:
GET https://registry.npmjs.org/<name>/<version>
for example: https://registry.npmjs.org/camelcase/2.1.1
But for scoped packages like @angular/core
this doesn't work. I tried all of the following, but they all fail:
- https://registry.npmjs.org/@angular/core/6.1.10 - 401 Unauthorized
- https://registry.npmjs.org/@angular%2Fcore/6.1.10 - 401 Unauthorized
- https://registry.npmjs.org/%40angular%2Fcore/6.1.10 - 401 Unauthorized
- https://registry.npmjs.org/%40angular%2Fcore%2F6.1.10 - 404 Not Found
What is the correct way for querying a specific version of a scoped package?
You can do this from a bash command:
So npm is adding some authentication to the request for scoped packages. For this to work you have to have a valid package.json in the local directory.
Of course, worst case, you can do a process.spawn() to run the npm command.
FYI, I tried using the npm-registry-client package, with my npm credentials:
and I got this:
It appears they don't allow specific version querying, but per @RobC's comments below, they do allow grabbing the entire repository's information, so you can do this client-side: