Setting a custom location for node_modules path with yarn 09 October 2019 07:49 Sam MacDonald Yarn, Node (0) TweetShareWhen installing packages with yarn the default folder that they are added to is “node_modules” in the directory of the project. Normally this does not present a problem unless you want to setup a different folder structure for your project. The problem I have seen with yarn as I have just started to use it with my projects is that the documentation is not the most concise that can be found.One way we can change the output is to append the command line with the option of --modules-folder. this option works but can be a problem when updating modules or if you have a large number of packages that you would like to add to your project.Yarn does have a way of configuring command line options for a project by including a .yarnrc file in the same folder as your package.json file. Yarn will use this file every time a command is executed. Within this file we can place the following –-modules-folder some/folder, now when we run yarn it will automatically place the packages in the some/folder structure.This allows us to provide a custom location for using our packages and changing the project file structure easily and consistently.