Skip to content

[DOCS] libnpmhook examples are outdated #5558

Closed
@mt-empty

Description

@mt-empty

Is there an existing issue for this?

  • I have searched the existing issues

This is a CLI Docs Problem, not another kind of Docs Problem.

  • This is a CLI Docs Problem.

Description of Problem

I'm trying to use libnpmhook. It says to use token when querying but that doesn't work because it has been renamed to authToken

I tried a simple ls query using authToken and npm automation token, but I still get unauthorized!

const hooks = require('libnpmhook')
export async function listNPMHooks(token: string) {
	const response = await hooks.ls({
		authToken: token
		})
	return response
}
  headers: [Object: null prototype] {
    date: [ 'Thu, 22 Sep 2022 02:50:08 GMT' ],
    'transfer-encoding': [ 'chunked' ],
    connection: [ 'keep-alive' ],
    'cf-ray': [ ffffffffffffffffff-MARS' ],
    'cf-cache-status': [ 'DYNAMIC' ],
    vary: [ 'Accept-Encoding' ],
    server: [ 'cloudflare' ],
    'x-fetch-attempts': [ '1' ]
  },
  statusCode: 401,
  code: 'E401',
  method: 'GET',
  uri: 'https://registry.npmjs.org/-/npm/v1/hooks',
  body: Buffer(0) [Uint8Array] [],
  pkgid: undefined
}

Any help?

Potential Solution

No response

Affected URL

https://github.com/npm/cli/tree/latest/workspaces/libnpmhook

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentationdocumentation related issuePriority 2secondary priority issuews:libnpmhookRelated to the libnpmhook workspace

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions