Sometimes we may choose to change the default location of the node_modules folder when we work with yarn to benefit from some form of caching (e.g. in CI).

When node packages live outside the project repository, our build may start failing with the following error unable to find typings for libraries even if they appear in the package.json

--modules-folder /var/cache/node_modules
.yarnrc configuration file
TS2307: Cannot find module 'lodash'
build error

To work around this issue, create a node_modules symlink pointing to the custom installation location from the .yarnrc file:

ln -s /var/cache/node_modules node_modules

The build should be working again.