简体   繁体   English

node 项目中如何保证依赖隔离?

[英]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.

相关问题 如何在npm项目中查找node-gyp依赖项(..或任何依赖项) - How to find node-gyp dependency (..or any dependency) in npm project 使用nestjs / node / npm项目如何覆盖传递依赖 - With nestjs / node / npm project how to override a transitive dependency 如何更新本地 node_module 依赖项并在另一个项目中重新加载? - How to update local node_module dependency and reload in another project? 在java项目中添加node js项目作为依赖 - Add node js project as a dependency in a java project 如何在 node.js 中使用依赖的依赖 - How to use dependency of dependency in node.js 如果包已经包含类型定义,如何在webpack项目中导入node-js依赖项? - How to import node-js dependency in webpack project if package already includes types definitions? 我如何找出Node.js项目中缺少的依赖项 - How do I figure out what dependency is missing in a Node.js project 当项目作为依赖项包含时,节点模块的控制内容 - Control content of node module when included as dependency by a project react-native node 依赖安装破坏了项目 - react-native node dependency install broke project 从nodejs项目构建rpm包时缺少节点依赖性 - missing node dependency when building an rpm package from nodejs project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM