Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[FEATURE] Allow satisfies to throw errors

Abierto
#418 2 comentarios 2 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
38/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
javascript, node.js
Área
tooling

Línea de trabajo

Start with functions/satisfies.js and the referenced error location in classes/range.js. Reproduce the invalid range during npm install using the package.json example, then trace how satisfies handles it. Done means the invalid range is distinguishable from an invalid version and produces the requested range error.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Enhancement semver:major

What / Why

It would be nice to have satisfies throw an error so that we may see that the range does not satisfy due to an invalid range as opposed to an invalid version. The range error that we'd like to see is here: https://github.com/npm/node-semver/blob/cb1ca1d5480a6c07c12ac31ba5f2071ed530c4ed/classes/range.js#L41

When

  • When verifying engine versions during npm install
  • When adding a dependency to package.json during npm install

Where

  • npm/node-semver

How

Current Behavior

Create an empty project with the following package.json:

{
  "name": "foo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "engines": {
    "node": ">=6.5.0 !15"
  },
  "engineStrict": true
}

Run npm install and you get:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '>=6.5.0 !15' },
npm WARN EBADENGINE   current: { node: 'v16.11.1', npm: '8.0.0' }
npm WARN EBADENGINE }

up to date, audited 1 package in 414ms

found 0 vulnerabilities
Expected Behavior

Create an empty project with the following package.json:

{
  "name": "foo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "engines": {
    "node": ">=6.5.0 !15"
  },
  "engineStrict": true
}

Run npm install and ideally get something like:

npm WARN EBADENGINE Invalid SemVer Range: >=6.5.0 !15

up to date, audited 1 package in 414ms

found 0 vulnerabilities

Who

  • n/a

References

  • n/a
Lenguaje dominante
JavaScript
Estrellas
5.5k
Forks
622
Merge medio
4 d 23 h
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de npm/node-semver

Todos los issues de npm/node-semver

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.