src: add env and cli option to disable global search paths
For embedders it is usually not allowed for Node.js to search modules from global paths like $HOME/.node_modules
, otherwise the behavior of the app could be changed because of a global installed module. For example, a global installed electron
module should not break all require('electron')
calls.
This PR adds an option to disable searching modules from global paths.
Also note that this change will have a merge conflict with https://github.com/nodejs/node/pull/39712.