- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将 yarn workspaces + lerna 实现到我的项目中。我有一个简单的结构:
--package.json
--node_modules/
--@app/
|--client/
|--package.json
|--node_modules/
|--server/
|--package.json
|--node_modules/
|--db/
|--package.json
|--node_modules/
其中 client/是一个 React-Native 应用程序。我知道 react-native 中的陷阱,并修改了我的根 /package.json
如下:
"workspaces": {
"packages": [
"@app/*"
],
"nohoist": [
"**/react-native",
"**/react-native/**",
]
},
据我了解,这应该可以防止 react native 本身以及 react-native 的任何依赖项被提升。但是,我遇到的是像 react-native-linear-gradient
和 react-native-reanimated
这样的 react-native 库(仅存在于 client/package.json
) 被提升并安装在根级别 node_modules
。它甚至不仅仅是被提升的原生模块。 Javascript 依赖项也被提升:
当然,nohoist
选项甚至不应该在这里发挥作用,因为这些模块只在 client/
目录中使用。
那为什么要把它们吊到根呢?
为了更好地衡量,我删除了每个工作区中的 yarn.lock
文件,只保留根目录一级。在运行 lerna clean
和 rm -rf node_modules
之后,我在根级别运行了 yarn install
。
有趣的是,此安装非常长(3-5 分钟)。仅删除根级别 node_modules
甚至需要大约 20 秒。我完全不确定 yarn workspaces+lerna 是否正常。
yarn 版本 - 1.22.10
最佳答案
what I am experiencing is that react-native libraries like react-native-linear-gradient and react-native-reanimated (which exist solely in client/package.json) are being hoisted and installed at the root level node_modules
这是预期的行为,因为它们不是 react-native
的依赖项。您必须指定相当多的模式,例如:
"nohoist": [
"**/react-native",
"**/react-native/**",
"**/react-native*",
"**/native-base",
"**/react-redux",
// OMG...
]
匹配所有...
我实际上会建议简单地添加这个:
"workspaces": { "nohoist": "**" }
到 client/package.json
文件。
这将导致 client
包的 所有 依赖项安装在 client/node_modules
中——就好像它是一个独立的 React Native 项目一样在其父级没有工作区。
否则,在一般情况下添加新包(以及尤其是 native 模块包)时,您必须时刻保持警惕——您的nohoist
模式是否反射(reflect)了您拥有的所有库添加?
此外,自动链接和提升也存在问题。
换句话说,Yarn Workspaces 的重复数据删除功能被高估了。它仅略微减少了磁盘空间的使用,并且仅nohoist
一切并仅在真正有用的情况下使用 Workspaces 可能更简单——以便于本地包链接。
关于react-native - Yarn Workspaces 是提升只存在于一个工作空间中的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65984258/
YARN 中的 yarn-site.xml 与 yarn-default.xml 有什么区别?看起来yarn-default.xml 在Hadoop 2.2 中已被弃用? 最佳答案 在所有 Hadoo
我们有一个在 yarn 上运行的流媒体应用程序,我们希望确保它 24/7 全天候运行。 有没有办法告诉 yarn 在失败时自动重启特定的应用程序? 最佳答案 你试过了吗Hadoop Yarn - Re
我在根队列下有 4 个队列,配置如下。 |-------------|-----------------|---------------------|-------------------| | Qu
我正在使用 YARN(和 Dask)版本 Hadoop 2.7.3-amzn-1 在 AWS EMR 上构建应用程序。我正在尝试测试各种故障场景,并且我想模拟容器故障。我似乎找不到一种简单的方法来杀死
我想创建一个 cron 来通过它的应用程序名称杀死一个 yarn 应用程序(Spark)。但我发现 yarn 应用程序 -kill 需要一个应用程序 ID。是否有解决方案可以通过应用程序名称杀死它,或
我正在尝试从此链接运行通用入门套件:https://github.com/ng-seed/universal即使我按照步骤安装了 Yarn,当我运行命令来运行服务器时,它给了我以下错误: 错误:找不到
我正在尝试 YARN 2.2 中的分布式 Shell 示例,希望有人能澄清托管和非托管应用程序管理器之间的区别是什么? 例如以下几行出现在客户端代码中 // unmanaged AM appConte
我有一个像这样的工作区项目: /project - package.json /packages /project-a package.json
这两个到底做什么用,在哪里使用它们? yarn 安装 yarn 构建 最佳答案 简而言之,yarn install 是用于安装项目所有依赖项的命令,通常在 package.json 文件中分配。在大多
所以,到目前为止,似乎没有 yarn audit --fix ,所以我想弄清楚如何修复我的 yarn audit错误。 我试过 yarn upgrade它修复了一些错误(这很好),但仍然存在一些错误。
我正在使用一个使用 yarn 的 dockerized pyspark 集群。为了提高数据处理管道的效率,我想增加分配给 pyspark 执行程序和驱动程序的内存量。 这是通过将以下两个键值对添加到
我尝试重新安装yarn,但重新安装后发现这个问题,我尝试搜索互联网但没有找到解决方案。 fiii@neo:~$ yarn --version node:internal/modules/cjs/loa
我正在试验2号纱和植面。 我创建了一个新文件夹:/projects/yarn2/根据他们的安装指南https://yarnpkg.com/getting-started我跑了 cd /projects
我是hadoop和YARN的新手。启动hdfs之后,我使用软件包中提供的start-yarn.sh启动YARN并出现错误。 我在Ubuntu 18.04上使用hadoop 3.2.0,jdk-11。
Apache Spark最近更新了版本至0.8.1,新增了yarn-client模式。我的问题是,yarn-client 模式的真正含义是什么?在文档中它说: With yarn-client mod
我们有一个在 HDFS 2.7.3 上运行的 Spark 流应用程序,使用 Yarn 作为资源管理器....在运行应用程序时......这两个文件夹 /tmp/hadoop/data/nm-local
我的机器上的 yarn 命令有问题。我的机器上安装了 hadoop 和 yarn 包管理器(Javascript)。当我运行 yarn init 时,它调用 hadoop 的 YARN 并响应: Er
我正在尝试运行此处列出的简单 yarn 应用程序:https://github.com/hortonworks/simple-yarn-app 我是 Java 和 Hadoop 的初学者,当我尝试使用
我正在尝试使用 YARN node labels标记工作节点,但是当我在 YARN(Spark 或简单的 YARN 应用程序)上运行应用程序时,这些应用程序无法启动。 使用 Spark,指定 --co
我一直只使用 npm 而从不显式使用 yarn/webpack。我需要从这个 repo 运行代码: https://github.com/looker-open-source/custom_visua
我是一名优秀的程序员,十分优秀!