Unable to authenticate, need: Basic, Bearer while connecting to private registory

95 views Asked by At

I am using a class called Generator that tries to connect with the registry that is present in running in the Localhost:4873 using verdaccio.

Generator.js

const dummySpecPath = path.resolve('/Users/aaayush/Desktop/generator/test/docs/dummy.yml');
    const generator = new Generator('@asyncapi/[email protected]', outputDir,
          { forceWrite: true, templateParams: { singleFile: true },
            registry: {url: 'http://localhost:4873/', username: 'admin', password: 'bmltZGE='}});
    await generator.generateFromFile(dummySpecPath);
    const file = await readFile(path.join(outputDir, 'index.html'), 'utf8');

config.yml

storage: ./storage
auth:
  htpasswd:
    file: ./htpasswd
    algorithm: bcrypt
uplinks:
  npmjs:
    url: https://registry.npmjs.org/
packages:
  "@*/*":
    access: $authenticated
    proxy: npmjs
log: { type: stdout, format: pretty, level: debug }

The Generator class internally called the Arboist.

const arb = new Arborist(Registry);

but when i run the Generator.js I am getting following error:

HttpErrorAuthUnknown: Unable to authenticate, need: Basic, Bearer
    at /Users/aaayush/Desktop/generator/node_modules/npm-registry-fetch/check-response.js:84:17
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Arborist.[nodeFromEdge] (/Users/aaayush/Desktop/generator/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1048:19)
    at async Arborist.[buildDepStep] (/Users/aaayush/Desktop/generator/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:917:11)
    at async Arborist.buildIdealTree (/Users/aaayush/Desktop/generator/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:215:7)
    at async Promise.all (index 1)
    at async Arborist.reify (/Users/aaayush/Desktop/generator/node_modules/@npmcli/arborist/lib/arborist/reify.js:148:5)
    at async /Users/aaayush/Desktop/generator/lib/generator.js:578:31

The Veradaccio is act as a proxy for @asyncapi/[email protected] I cannot able to download the file, I tried multiple ways but cannot able to rectify the error.

0

There are 0 answers