在同一个项目里设置多个版本的 node_modules,运行时通过指定参数选取不同的 node_modules 运行,这种做法是否可行?
|
lrz0lrzAug 24, 2018
1
使用 NODE_PATH 或者 NODE_PRESERVE_SYMLINKS 应该都可以解决这个问题。
|
|
weixiangzheAug 24, 2018
2
webpack 的话可以设置 resolve
```js .... resolve: { modules: [ path.resolve(__dirname, 'other_modules/node_modules'), 'node_modules', ], }, ... ``` |
|
3
@lrz0lrz 请问 NODE_PATH 是指系统变量吧?设置了没有效果
|
|
lrz0lrzAug 27, 2018
4
|
|
5
NODE_PATH=$(pwd)/another-package/node_modules node app 在 windows 环境下不能运行
改成 set NODE_PATH=./another-package/node_modules&&node app 可以了 @lrz0lrz 非常感谢你的帮助 |