如何更改Yarn的默认软件包目录? [英] How to change Yarn default packages directory?
问题描述
使用Yarn安装依赖项时,默认情况下会将它们放置在node-modules
目录中.
When Yarn is used to install dependencies, it puts them in node-modules
directory by default.
如何将其更改为Laravel resources
文件夹?
就像.bowerrc
用于凉亭设置"directory": "resources/assets"
How can I change this to i.e Laravel resources
folder?
Like .bowerrc
is used for bower to set "directory": "resources/assets"
推荐答案
yarn install --modules-folder ./resources
更新: 请密切注意此GitHub 问题,因为此功能不太稳定.
UPDATE: Keep an eye on this GitHub Issue as this feature is not quite stable.
更新2:从下面的达米恩(Damien)答案中,您可以将--install.modules-folder "./resources"
添加到 .yarnrc
文件,这样您就不需要连续为每个后续调用传递命令行参数.请注意,必须使用双引号.如果没有这些内容,您将得到Invalid value type 1:25
或类似错误.
UPDATE 2: From Damien's answer below, you can add --install.modules-folder "./resources"
to a .yarnrc
file so that you don't need to continually pass the commandline argument in for each subsequent invocation. Note that double quotes are required; without those, you will get an Invalid value type 1:25
or similar error.
然后您可以将.yarnrc
提交给源代码管理,以便项目中的其他开发人员可以自动使用相同的设置.
You can then commit the .yarnrc
to source control so that other developers on the project can use the same settings automatically.
这篇关于如何更改Yarn的默认软件包目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!