简体   繁体   English

更改特定于项目的node_modules路径

[英]Change node_modules path specific to project

I have a project structure 我有一个项目结构

|-app
   |-...
|-libs
|- package.json
|- index.html

I want the node_modules folder to be inside 'libs' folder. 我希望node_modules文件夹位于“ libs”文件夹中。 Like this- 像这样-

|-app
   |-...
|-libs
   |-node_modules
       |-angular
       |-...
|- package.json
|- index.html

Is there any way to set configuration for this. 有什么办法可以为此设置配置。 so that next time I install any package, that will be dependency will directly go to that folder. 这样,下次我安装任何软件包时,依赖关系将直接转到该文件夹​​。

just cd into the folder and run npm init . 只需cd进入文件夹并运行npm init That will create package.json file. 这将创建package.json文件。 Then you can add packages which will be installed in node_modules inside that folder. 然后,您可以添加将安装在该文件夹内的node_modules中的软件包。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM