Skip to content

[Question] Is there any way to prevent users from running 'npm install <package name>' #16942

Closed

Description

@hekod777

While using yarn, I want to have some kind of mechanism to prevent people from using npm install <package name>. I'd like to know if there is any way to get this done.

additional notes:

  1. add the following codes to package.json can prevent people from using npm install
  "scripts": {
    "preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('You must use Yarn to install, not NPM')\""
  },
  1. I asked the same questions in yarn's issue page:

yarnpkg/yarn#4895

Activity

  1. cjihrig commented on Nov 10, 2017

    @cjihrig
    Contributor

    The yarn issue tracker is the correct place for this question. Thanks!

  2. added
    wrong repoIssues that should be opened in another repository.
    on Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wrong repoIssues that should be opened in another repository.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions