纱线安装不工作,得到 "Other managers are not allowed"

Yarn install not working, getting "Other managers are not allowed"

我刚开始在我的一个项目中使用 yarn 包管理器。我使用 sudo npm install yarn -g

在全球范围内安装了 yarn

但是当我尝试使用 yarn install 安装依赖项时,我在 CLI 上得到以下信息

info No lockfile found.
$ node tools/preinstall
=========================================
Please install / add dependencies via npm
Other managers are not allowed
=========================================
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

这很奇怪。知道为什么我会得到这个吗?无论如何,我可以为我的项目启用 yarn 吗?

感谢期待

看起来它是由于 preinstall 脚本而发生的。感谢@Kevin 的回答,你救了我的命。