Locations tree. It starts with the map of location roots and continues as maps of nested directory entries.
Example: Map { '' => children: Map { 'react-apollo' => { children: Map { 'node_modules' => { children: Map { '@apollo' => { children: Map { 'react-hooks' => { children: Map {}, locator: '@apollo/react-hooks:virtual:cf51d203f9119859b7628364a64433e4a73a44a577d2ffd0dfd5dd737a980bc6cddc70ed15c1faf959fc2ad6a8e103ce52fe188f2b175b5f4371d4381544d74e#npm:3.1.3' } } } } } }, locator: 'react-apollo:virtual:2499dbb93d824027565d71b0716c4fb8b548ad61955d0a0286bfb3c5b4058e227894b6691d96808c00f576db14870018375210362c26ee321ea99fd6ed041c74#npm:3.1.3' }, }, 'packages/client' => children: Map { 'node_modules' => Map { ... } } ... }
Example: Map { '' => children: Map { 'react-apollo' => { children: Map { 'node_modules' => { children: Map { '@apollo' => { children: Map { 'react-hooks' => { children: Map {}, locator: '@apollo/react-hooks:virtual:cf51d203f9119859b7628364a64433e4a73a44a577d2ffd0dfd5dd737a980bc6cddc70ed15c1faf959fc2ad6a8e103ce52fe188f2b175b5f4371d4381544d74e#npm:3.1.3' } } } } } }, locator: 'react-apollo:virtual:2499dbb93d824027565d71b0716c4fb8b548ad61955d0a0286bfb3c5b4058e227894b6691d96808c00f576db14870018375210362c26ee321ea99fd6ed041c74#npm:3.1.3' }, }, 'packages/client' => children: Map { 'node_modules' => Map { ... } } ... }
This function removes node_modules roots that do not exist on the filesystem from the location tree.
This is needed to transparently support workflows on CI systems. When user caches only top-level node_modules and forgets to cache node_modules from deeper workspaces. By removing non-existent node_modules roots we make our location tree to represent the real tree on the file system.
Please note, that this function doesn't help with any other inconsistency on a deeper level inside node_modules tree, it helps only when some node_modules roots do not exist at all
This is needed to transparently support workflows on CI systems. When user caches only top-level node_modules and forgets to cache node_modules from deeper workspaces. By removing non-existent node_modules roots we make our location tree to represent the real tree on the file system.
Please note, that this function doesn't help with any other inconsistency on a deeper level inside node_modules tree, it helps only when some node_modules roots do not exist at all
location tree
location tree with non-existent node_modules roots stripped
Generated using TypeDoc
@yarnpkg/plugin-node-modules
This plugin adds support for installing packages through a
node_modules
folder.Install
This plugin is included by default in Yarn 2, but is still considered experimental. For this reason, you must enable it manually by adding the following to your
.yarnrc.yml
file:nodeLinker: node-modules
Word of caution
While they are supported by virtually every tool, installs using the
node_modules
strategy have various fundamental issues that the default Plug'n'Play installations don't suffer from (for more details, check out our documentation). Carefully consider the pros and cons before enabling this plugin.