[英]How to ensure dependency isolation in node project?
I 'm reading the 12-factor-app manifesto and stumbled upon the concept of dependency isolation here .我正在阅读12-factor-app manifesto并在这里偶然发现了依赖隔离的概念。 I'm familiar with the concept from working in Python projects using conda .
我熟悉使用conda在 Python 项目中工作的概念。 But how can I achieve the same kind of isolation in a nodeJS application?
但是如何在nodeJS应用程序中实现同样的隔离呢?
I had the case in the past where I had eslint
installed globally but not defined in package.json
in the project.过去我有这样的情况,我全局安装了
eslint
,但在项目的package.json
中没有定义。 The CI/CD failed later because of a missing dependancies.由于缺少依赖项,CI/CD 稍后失败。 So I know how much important this can be.
所以我知道这有多重要。
Of course I can always run my apps inside isolated docker containers, but I feel like this is an overkill for local development specially for small projects.当然,我总是可以在隔离的 docker容器中运行我的应用程序,但我觉得这对于小型项目的本地开发来说有点过头了。
Is there any way to ensure dependancy isolation in nodejs projects?有什么方法可以确保 nodejs 项目中的依赖隔离?
I believe yarn.lock (for yarn) serves the purpose.我相信 yarn.lock (用于纱线)可以达到目的。 All deps are written down there and you can store in source control
所有的部门都写在那里,你可以存储在源代码管理中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.