grunt: possible to relocate “node_modules” for plugins?

六月ゝ 毕业季﹏ 提交于 2019-12-30 17:25:35

问题


If I install any grunt plugin, it is added to a folder named "node_modules" in the root of my project dir per default.

My question: is it possible to move this whole folder (and therefore all plugins) to another location (but still within my project folder), let's say to "build/node_modules" ?

Of course, I still want to be able to run grunt from anywhere in my project hierarchy after this change.


回答1:


Nope, that's a feature of the Node.JS core files. In the case you don't know, Node.JS is the platform which Grunt was built.

All require() calls which don't point to an absolute file or start with ./ will try to find modules inside node_modules folders.




回答2:


You can use symbolic link ln -s /original_node_modules_path/node_modules ./node_modules



来源:https://stackoverflow.com/questions/16738177/grunt-possible-to-relocate-node-modules-for-plugins

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!