2017-04-14 40 views
24

当我使用npm install fancyapps/fancybox#v2.6.1 --save时,fancybox pkg at v2.6.1标签将被安装。这种行为描述在docs如何从github回购纱线安装包

我想问一下,如何用yarn来做到这一点?

这个命令是否正确?在yarn docs不是关于这种格式。

yarn add fancyapps/fancybox#v2.6.1

回答

31
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. 

2.6.1未在GIT中的fancybox版本avaliable

yarn add https://github.com/fancyapps/fancybox [remote url] 

yarn add https://github.com/fancyapps/fancybox#3.0 [branch] 

yarn add https://github.com/fancyapps/fancybox#5cda5b529ce3fb6c167a55d42ee5a316e921d95f [commit]