Can a custom directory name be used instead of 'node_modules' when installing node packages?

前端 未结 3 550
我寻月下人不归
我寻月下人不归 2020-12-14 05:42

I create a package.json, I run npm install, it works alright. It creates a node_modules directory in my root folder (which I can chang

3条回答
  •  不知归路
    2020-12-14 06:14

    There is no way to change it. The node_modules folder is actually not specific to NPM, it is part of Node's core module loading system. Seen here in module.js.

    Changing it globally as you've mentioned would also potentially break some of the modules you are using too, as modules are sometimes packages with their dependencies already present in node_modules and changing it would cause that to break.

提交回复
热议问题