Skip to content

preinstall script fails to block other package managers #33

@karthikappiah

Description

@karthikappiah

As per the docs, to prevent other package managers , I used this preinstall script to your package.json:

{
	"scripts": {
		"preinstall": "npx only-allow pnpm"
	}
}

Its expected behavior is to block these edge cases (and thus only allow PNPM):

  • npm i
  • npm i package
  • npm i -D package

However, its observed behavior blocks npm i from running, but allows npm i package and npm i -D package to run.
Even though only-allow blocks npm i from running, npm i still creates package-lock.json.

I tried different variations of the preinstall script, which all fail to block the aforementioned edge cases:

  • npx only-allow pnpm
  • npx -y only-allow pnpm (I'm using version pnpm@10.13.1)
  • only-allow pnpm (after pnpm add -D only-allow)

Unfortunately—until this problem is fixed—I cannot rely on the package only-allow!

Are there any workarounds? If so, I'd appreciate them in the documentation–I can help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions