英文:
Use of bitwise '|' with boolean operands | XCode 14.3 fails builds using react-native Yoga
问题
我刚刚将我的XCode更新到版本14.3,今天在Yoga文件中构建失败,错误信息如下:
使用布尔操作数进行按位“|”运算
看起来我们在iOS的Yoga包中遇到了一些问题。我不想再回退到较低的版本。如果有人可以帮助解决这个问题,那将很好。
我尝试过清除缓存数据和派生数据,然后清理构建。我还尝试过删除pods和node_modules,但都没有帮助。
英文:
Just updated my XCode to Version 14.3 today and build is failing with below error in Yoga file
Use of bitwise '|' with boolean operands
Looks like we have some issues with iOS yoga package. I don't want to rollback to lower version again. If someone can help to get over it, that would be nice.
I tried removing cached data and derived data & cleaning build. Tried removing pods and node_modules as well. But nothing has helped.
答案1
得分: 135
我通过在代码中将一个垂直线 | 替换为两个垂直线 || 来解决了这个问题。
然后清除了构建,现在在 XCode 14.3 上可以正常工作了。希望对某人有所帮助。
编辑:
上面的方法是临时解决方案。通过使用以下解决方案,我们不需要在每次 npm 安装时进行更改。这是由 @Carl G 建议的。@Mykola Odnosumov 在这个帖子中的解决方案也很有帮助,它是类似的解决方案。
感谢 @Carl G 和 @Mykola Odnosumov。
https://github.com/facebook/react-native/issues/36758#issuecomment-1496210081
- 安装 patch-package https://github.com/ds300/patch-package
- 修改源代码,就像这个提交 52d8a79
- 运行 npx patch-package react-native
- 提交你的更改。完成。
英文:
I resolved it by putting 2 Vertical bars || instead of one | in the code where it is failing.
Then cleared the build and it is working fine now on XCode 14.3. I Hope this helps someone.
Edit:
Above one is temporary solution.
By using following solution we do not need to make change on every npm installation. It is suggested by @Carl G. @Mykola Odnosumov 's Solution in this thread is also helpful, it is similar solution.
Thank you @Carl G and @Mykola Odnosumov
https://github.com/facebook/react-native/issues/36758#issuecomment-1496210081
- install patch-package https://github.com/ds300/patch-package
- Modify the source code like this commit 52d8a79
- run npx patch-package react-native
- commit your changes. Done.
答案2
得分: 41
General
此问题已在Yoga v1.19.0中修复。
查看此提交,日期为2022年4月12日,以及发布v1.19.0,日期为2021年5月21日。
How to fix
- 如果可能的话,将Yoga包更新到v1.19.0。
- 为了方便开发,请使用
patch-package
。- 在
package.json
文件中添加postinstall
脚本,调用patch-package
。 - 编辑
react-native/ReactCommon/yoga/yoga/Yoga.cpp
以修复使用了错误运算符的问题。 - 执行
npx patch-package react-native
以生成.patch
文件。 - 确保将
patches/
目录添加到git中。
- 在
英文:
General
This issue's been fixed in Yoga v1.19.0
Check out this commit dated Apr 12, 2022, and release v1.19.0 dated May 21, 2021.
How to fix
- Update the Yoga package to v1.19.0, if possible.
- Use
patch-package
for development ease- Add
postinstall
script topackage.json
file withpatch-package
call - Edit
react-native/ReactCommon/yoga/yoga/Yoga.cpp
to fix the issue with incorrect operator used - Execute
npx patch-package react-native
to generate.patch
file - Make sure to add
patches/
directory to git
- Add
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论