当我使用npm install fancyapps/fancybox#v2.6.1 --save时,所以fancybox包在v2.6.1将安装标签.docs中描述了这种行为

我想问,如何用yarn来做这个?

这个命令是正确的 Select 吗?In yarn docs与这种格式无关.

yarn add fancyapps/fancybox#v2.6.1

推荐答案

通过指定远程URL(HTTPS或SSH),可以将任何Git存储库(或tarball)作为依赖项添加到yarn:

yarn add <git remote url> installs a package from a remote git repository.
yarn add <git remote url>#<branch/commit/tag> installs a package from a remote git repository at specific git branch, git commit or git tag.
yarn add https://my-project.org/package.tgz installs a package from a remote gzipped tarball.

以下是一些例子:

yarn add https://github.com/fancyapps/fancybox [remote url]
yarn add ssh://github.com/fancyapps/fancybox#3.0  [branch]
yarn add https://github.com/fancyapps/fancybox#5cda5b529ce3fb6c167a55d42ee5a316e921d95f [commit]

(Note: Fancybox v2.6.1 isn't available in the Git version.)

要同时支持npm和Thread,可以使用git+url语法:

git+https://github.com/owner/package.git#commithashortagorbranch
git+ssh://github.com/owner/package.git#commithashortagorbranch

Node.js相关问答推荐

Express 4.18正文解析

如果非SQL函数在事务内部运行失败,PG-Promise事务会回滚吗?

MongoDB上的updateOne和findOneAndUpdate在Node.js中无法正常工作

从mongodb集合中获取每分钟数据的每小时数据

Promise 和 Azure 语音转文本

运行本地移动自动化测试时,在onPrepare钩子中,ERROR @wdio/cli:utils: A service failed in the 'onPrepare'

使用pm2启动服务器

Indexeddb 获取所有不同于特定值的记录

如何在 Docker 容器中 SSO 登录 AWS(使用 aws-sdk v3)

为什么当我使用waitForSelector时 Puppeteer 导致我的测试套件挂起 30 秒,即使我在页面和浏览器上调用关闭?

我怎样才能让`git`失败而不是要求提供凭据

使用中的端口代码:'EADDRINUSE',即使在 kill 命令之后

node和mongoDB聚合数据时的输入字段函数

如何更改NodeJS中的堆栈大小限制?

如何防止 node.js 中的内存泄漏?

ISODate 未定义

NODEJS 进程信息

如何判断 Node.js 中是否设置了环境变量?

`return function *(){...}` 是什么意思?

deno vs ts-node:有什么区别