modules directory for different versions of Node.js
When using NVM, or otherwise switching between Node.js versions, node_modules has to be rebuilt for each Node version. Would it be possible somehow use a different node_modules directory for each version, instead of having to rebuild the contents everytime you switch between versions?
something like:
node_modules_v8/
node_modules_v7/
node_modules_v6/
Maybe there is a better way to do this, not sure.
Three suggestions (in my order of pref):
node_modules
folder that points to the correct version of modules that node
expects to run. NODE_PATH
setting and point it to the correct cache of your node_modules
folder (ie NODE_PATH=/etc/node_v8) just prior to executing your node
command. If you set it globally it would restrict you running multiple instances of node on that box so, you'd need to set the NODE_PATH
on a per process instance. 上一篇: 使用ls列出目录及其总大小
下一篇: 模块目录为不同版本的Node.js