我知道正在运行yarn add package@1.2.3
会安装package v1.2.3
。
我最近遇到了这种语法:yarn add package@npm
。 @npm
做了什么?这是纱线的特殊标志还是特定于该包装(material-ui
)?
我遇到了@npm
作为解决方案,通过别名下一个版本来包含两个版本的材料-ui:yarn add material-ui-next@npm:material-ui@next
答案 0 :(得分:1)
No real surprises, it is a directive to install a specific package from npm.
yarn add {package1}
installs the specified package from the npm registry by default.
yarn add {package1}@npm:{package2}
installs package2 from the npm registry and assigns package1 as its alias.
It makes no difference if a package named package1 exists in the npm registry, it will only download the package you've specified with the @npm directive.
From your question, it seems like you've already got a handle on this one.