简体   繁体   English

如何在node_modules以外的其他文件夹下安装节点模块?

[英]How to install a node module under a different folder than node_modules?

With npm install MODULE_NAME --save I save all the new modules under node_modules. 使用npm install MODULE_NAME --save我将所有新模块保存在node_modules下。 Is there a way of saving them under a different name? 有没有办法以不同的名义保存它们?

I glanced through the source code for npm, and I believe the answer is no, you cannot--there are several hard-coded references to the "node_modules" string. 我浏览了npm的源代码,我相信答案是否定的,你不能 - 对“node_modules”字符串有几个硬编码的引用。 Since npm is the package manager for Node, and Node uses the node_modules folder to load local modules, I doubt this will change. 由于npm是Node的包管理器,而Node使用node_modules文件夹来加载本地模块,我怀疑这会改变。

The FAQ is clear about it: you can't and you'll never be able to (using normal npm): 常见问题解答很明确:你不能和你永远不能(使用正常的npm):

https://npmjs.org/doc/faq.html https://npmjs.org/doc/faq.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为本地引用的节点模块指定node_modules文件夹 - How to specify node_modules folder for locally referenced node module 如何在node_modules目录之外本地安装节点模块? - How to locally install node module outside of node_modules directory? npm install 没有创建 node_modules 文件夹 - npm install not creating node_modules folder npm安装,缺少node_modules文件夹 - npm install, missing node_modules folder npm 安装未创建 node_modules 文件夹 - npm install is not creating node_modules folder 如果在gulpfile.js之外的不同文件夹中安装gulp(node_modules),你如何运行gulp - How do you run gulp if gulp is installed(node_modules) in different folder than gulpfile.js 与“ npm install”类似的自定义CLI,它将在“ node_modules”以外的文件夹中安装库 - Custom CLI similar to “npm install” that will install libs in folder other than “node_modules” 是否可以使 node 命令看到与指定位置不同的位置的 node_modules 文件夹? - Is it possible to make the node command see a node_modules folder on a different location than the specified one? 我可以更改位于node_modules文件夹下的模块中的文件吗 - Can i change a file located in a module under node_modules folder 如何访问 replit 中的 node_modules 文件夹? - How to access node_modules folder in replit?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM