javascriptnode.jsnpm

Enable audit command for enterprise registry npm


My question is about how to enable npm audit command in my npm enterprise registry

When I am trying to run npm audit command i am getting the following error

{
  "error": {
    "code": "ENOAUDIT",
    "summary": "Your configured registry (https://registry.npmjs.mydomain/) does not support audit requests.",
    "detail": ""
  }
}

Here is my research

I tried with the following command and its working

npm audit --json --registry https://registry.npmjs.org/

But when I use

npm audit --json --registry https://registry.npmjs.mydomain/

It does not work. How can I configure to make my registry to work with npm audit command


Solution

  • I have the same problem. We're using artifactory for private npm registry which doesn't support npm audit yet. Simplest solution which works for me is:

    npm audit --registry=https://registry.npmjs.org

    Alternative solution:

    1. backup config file for your private registry (most probably it's ~/.npmrc)
    2. change registry on public npm: npm set registry https://registry.npmjs.org
    3. use npm audit / npm audit fix
    4. revert private registry configuration back

    Update 2020

    In case of artifactory private npm registry - It does support npm audit now, so you can use npm audit / npm audit fix there without any additional configuration. But if your private npm registry still doesn't support npm audit – steps above will be valid for you.