# npm-limit

> Limit the use of specific package manager:npm,cnpm,yarn,pnpm...

Latest version **1.0.6** (published 2022-02-27) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install npm-limit
pnpm add npm-limit
yarn add npm-limit
bun add npm-limit
```

Provides the command `npm-limit`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2022-02-27 |
| First published | 2022-02-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | wangrongding |
| Maintainers | wangrongding |
| Keywords | npm, cnpm, yarn, pnpm, package, manager, limit, limiter |

## Links

- npm: https://www.npmjs.com/package/npm-limit
- Repository: https://github.com/wangrongding/npm-limit
- Homepage: https://github.com/wangrongding/npm-limit/
- Issues: https://github.com/wangrongding/npm-limit/issues
- npm.io page: https://npm.io/package/npm-limit

## Dependencies (2)

- [boxen](https://npm.io/package/boxen.md) ^6.2.1
- [chalk](https://npm.io/package/chalk.md) ^5.0.0

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2022-02-27
- 1.0.5 — 2022-02-27
- 1.0.4 — 2022-02-21
- 1.0.2 — 2022-02-21
- 1.0.1 — 2022-02-21
- 1.0.0 — 2022-02-21

## README

# npm-limit

一个 node 包管理器的约束工具，用于协同项目的统一规范(约束大家使用同一种包管理在该项目中进行包的安装或者升级)。

A constraint tool for Node package manager, which is used to unify specifications for collaborative projects (binding everyone to install or upgrade packages in the project using the same package management).

## 使用方法

👉 : Just add a command to 'package.json'!

👉： 只需要在`package.json`中添加一条命令！

使用以下命令快速添加 👇

```sh
npm set-script preinstall "npx npm-limit yarn"
```

或者手动添加 👇

```json
// package.json
{
  "scripts": {
    "preinstall": "npx npm-limit yarn"
  }
}
```

为了让其他人在此项目中只能通过我们指定的包管理器去安装依赖，我们需要在 `package.json` 里面添加一条脚本`"preinstall": "npx npm-limit [你要设置的包管理器名称yarn,npm,pnpm...]"`

To allow others to install dependencies in this project only through the package manager we specified，We need to add a script to 'package.json'，`"preinstall": "npx npm-limit [yarn,npm,pnpm...]"`

## 示例

当我们设置了上述的 script 后,执行 `pnpm i` 可以看到如下图所示的报错信息

When we set the script above, we can execute `pnpm i` and see an error message as shown below
![](https://gitee.com/wangrongding/image-house/raw/master/images/202202211343554.png)

当我们没有设置`"preinstall": "npx npm-limit [你要设置的包管理器名称yarn,npm,pnpm...]"`或者设置错误的时候,可以看到如下图所示的报错信息

When we don't set `"preinstall": "npx npm-limit [yarn,npm,pnpm...]"`，Or if the Settings are incorrect, you can see the error message as shown in the following figure
![](https://gitee.com/wangrongding/image-house/raw/master/images/202202211642694.png)

至此,包管理器的限制就可以实现啦 ~ 🥰

At this point, the package manager restriction is complete ~ 🥰

---
_Source: https://npm.io/package/npm-limit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
