Coder Social home page Coder Social logo

retry is not kicking in with npm 6.x about audit-ci HOT 4 CLOSED

ibm avatar ibm commented on August 28, 2024
retry is not kicking in with npm 6.x

from audit-ci.

Comments (4)

quinnturner avatar quinnturner commented on August 28, 2024 1

A bit of digging confirms that both are error messages:

This is certainly an issue. I am not a fan of processing the error message since it's very brittle, but a quick fix would be an if+elseif on the msg. Preferably, we could process the statusCode.

From the NPM audit src:

  if (err.statusCode >= 400) {
    let msg
    if (err.statusCode === 401) {
      msg = `Either your login credentials are invalid or your registry (${opts.registry}) does not support audit.`
    } else if (err.statusCode === 404) {
      msg = `Your configured registry (${opts.registry}) does not support audit requests.`
    } else {
      msg = `Your configured registry (${opts.registry}) may not support audit requests, or the audit endpoint may be temporarily unavailable.`
    }
    if (err.body.length) {
      msg += '\nThe server said: ' + err.body
    }
    const ne = new Error(msg)
    ne.code = 'ENOAUDIT'
    ne.wrapped = err
    throw ne
  }
  throw err

Note that his has been an issue for npm >= v6.10.2: nodejs/node@d7d321b

EDIT: Didn't mean to close!

from audit-ci.

quinnturner avatar quinnturner commented on August 28, 2024 1

A quicker fix is simply to shorten the partial error message matching to not support audit. This way, all error messages are captures. Eventually, this should be cleaned up into proper error code handling, but this is an improvement over the current solution.

from audit-ci.

bartvde avatar bartvde commented on August 28, 2024 1

thanks @quinnturner !

from audit-ci.

bartvde avatar bartvde commented on August 28, 2024

@djomaa since you did the original PR at #82, do you have any idea why the error is not getting matched with npm 6.13.7?

from audit-ci.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.