Skip to content

EBADDEVENGINES error when package.json contains devEngines configuration other than npm #62

Description

@stazz

When using this (e.g. via ESLint extension in VSCode) in projects that have the following in their package.json file:

{
  "devEngines": {
    "packageManager": {
      "name": "pnpm",
      "version": "11.4.0+sha512.f0febc7e37552ab485494a914241b338e0b3580b93d54ce31f00933015880863129038a1b4ae4e414a0ee63ac35bf21197e990172c4a68256450b5636310968f"
    }
  }
}

The installUsingNPM function in src/index.ts will fail to:

npm error EBADDEVENGINES The developer of this package has specified the following through devEngines
npm error EBADDEVENGINES Invalid devEngines.packageManager
npm error EBADDEVENGINES Invalid name "pnpm" does not match "npm" for "packageManager"
npm error EBADDEVENGINES {
npm error EBADDEVENGINES   current: { name: 'npm', version: '11.12.1' },
npm error EBADDEVENGINES   required: {
npm error EBADDEVENGINES     name: 'pnpm',
npm error EBADDEVENGINES     version: '11.4.0+sha512.f0febc7e37552ab485494a914241b338e0b3580b93d54ce31f00933015880863129038a1b4ae4e414a0ee63ac35bf21197e990172c4a68256450b5636310968f'
npm error EBADDEVENGINES   }
npm error EBADDEVENGINES }

Instead of hard-coding using npm, one could check whether process.env.npm_execpath exists, and use that instead. There are docs too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions