I am currently facing a challenge with transferring all of our npm modules from npmjs.com to a new location. The issue is that our modules are saved under a private npm user account, making it difficult for me to programmatically access and consume all the packages owned by this user.
While I have come across several examples demonstrating how to migrate individual packages or a list of packages based on their names, I am still struggling to figure out how to retrieve a complete list of packages owned by a user.
There are a few tools available for interacting with the NPM registry API, but unfortunately, none seem to support fetching private scoped packages. Currently, I am experimenting with the npm-registry-fetch package in an attempt to create a sample query, but so far, I have been unsuccessful.
Below is the code snippet that I am trying to execute -
var npmFetch = require('npm-registry-fetch')
async function run() {
var response = await npmFetch.json('@<scope redacted>/<package name redacted>',{token: '<token redacted>'})
}
run()
Running this code generates the following error message -
HttpErrorGeneral: 404 Not Found - GET https://registry.npmjs.org/@<scope redacted>/<package name redacted> - Not found
If anyone has insights on how I can effectively query these types of packages, your assistance would be greatly appreciated.
Thank you.