Yarn you can easily achieve this by adding a file called '.yarnrc'
with contents like this:
# ./.yarnrc
--modules-folder lib
Next time you run 'yarn' it will create the lib folder and install packages into there instead of into node_modules.
Now if only we could get 'npm install' to be as clever.