[英]Include .npmrc while creating a new angular project
I am creating a command line application using node.js.我正在使用 node.js 创建一个命令行应用程序。 The application wraps the
ng new
command from angular CLI.该应用程序包装了来自 angular CLI 的
ng new
命令。 While creating a new angular project, dependencies are installed automatically.在创建新的 angular 项目时,会自动安装依赖项。
The problem here is we are using a private npmjs repository which at times may not have some specified dependencies in it.这里的问题是我们使用了一个私有的 npmjs 存储库,它有时可能没有一些指定的依赖项。 To avoid this situation, I thought to have a .npmrc file in which I can define to fetch the organization specific node modules from the private repository and rest of the node modules from the npm repository.
为了避免这种情况,我想有一个 .npmrc 文件,我可以在其中定义从私有存储库中获取组织特定的节点模块,并从 npm 存储库中获取其余的节点模块。
Is there any way, using which I can add a .npmrc file during angular project creation with the command ng new?有什么方法可以在使用 ng new 命令创建角度项目期间使用它添加 .npmrc 文件吗?
Thanks in advance提前致谢
You can do this to avoid using global config:您可以这样做以避免使用全局配置:
yarn init
in the directoryyarn init
yarn add ng
so it adds ng from the repository you listedyarn add ng
所以它从你列出的存储库中添加 ngng new ${yourprojectname}
to use the local ng you just createdng new ${yourprojectname}
使用你刚刚创建的本地 ngnpm install
just to be sure.npm install
以确保。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.