react-native - 如何修复与哨兵相关的纱线错误:ENOENT:没有这样的文件或目录,scandir '.../src/native/node_modules/@sentry'
问题描述
我正在尝试通过 yarn 在我的 react-native 项目中安装新软件包,但被上述错误消息所困扰。
我已经通过 npm 而不是 yarn 安装了 react-native-sentry。任何从项目的其余部分卸载和取消链接的尝试都无济于事。没有其他建议发布(https://github.com/getsentry/sentry-electron/issues/94)让我克服了第一个错误。在此初始错误之后,任何后续尝试在 Xcode 中构建yarn
都会给我带来更多错误。
我的(截断)src/native/package.json
:
{
"name": "native",
.
.
.
"workspaces": {
"nohoist": ["@sentry", "@sentry/**"]
},
.
.
.
},
"dependencies": {
.
.
.
"react-native-sentry": "^0.39.0",
最初的错误:
$ yarn
yarn install v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > [XXXX].shared-components@1.0.0" has unmet peer dependency "react@^16.5.0".
warning "workspace-aggregator-ad0ee18a-71f6-4b7e-ae5b-7d9c0089e4da > hydrated-oauth-redux > @callstack/async-storage@1.1.0" has unmet peer dependency "react-native@^0.38".
warning "workspace-aggregator-ad0ee18a-71f6-4b7e-ae5b-7d9c0089e4da > hydrated-oauth-redux > babel-jest@22.4.4" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-0".
warning "workspace-aggregator-ad0ee18a-71f6-4b7e-ae5b-7d9c0089e4da > native > enzyme-adapter-react-16@1.11.2" has unmet peer dependency "react-dom@^16.0.0-0".
error An unexpected error occurred: "ENOENT: no such file or directory, scandir '[XXXX]/src/native/node_modules/@sentry'".
info If you think this is a bug, please open a bug report with the information provided in "[XXXX]/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
当尝试在模拟器中运行应用程序时,这会导致 Xcode 中出现后续错误,从而迫使我将整个项目恢复到之前的提交。
/Users/[XXXX]/Library/Developer/Xcode/DerivedData/[XXXX]/Build/Intermediates.noindex/[XXXX].build/Debug-iphonesimulator/[XXXX].build/Script-00DD1BFF1BD5951E006B06BC.sh: line 5: export: `/[XXXX]/src/native/ios/.."': not a valid identifier
/Users/[XXXX]/Library/Developer/Xcode/DerivedData/[XXXX]/Build/Intermediates.noindex/[XXXX].build/Debug-iphonesimulator/[XXXX].build/Script-00DD1BFF1BD5951E006B06BC.sh: line 7: ../node_modules/@sentry/cli/bin/sentry-cli: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
许多其他人都面临类似的错误,但我不相信这是我问题的根源。他们的解决方案都没有帮助。
我已经尝试卸载哨兵并完全擦除项目中的每一个提及,恢复到以前的提交,通过多个包管理器重新安装 nvm 和 yarn 以及 react-native-sentry,但没有运气。
解决方案
推荐阅读
- python-3.x - 如何使用 Selenium 检索 WebElement 的文本 - Python
- javascript - Monaco 编辑器中的虚拟键盘
- c# - c# OpenFileDialog, Streamreader, Datatable, skip first line after open next file
- reactjs - 带有 LIKE 运算符的下拉菜单 react-bootstrap-table2
- angularjs - angularJS中组件内的组件
- consul - hashicorp consul is not publishing all the metrics
- instagram - Instagram api thumbnail_url 给出 5xx 服务器错误
- python-3.x - 识别重叠对象
- c# - 检查结束前是否少于 7 天
- jquery - If/else statement making link work or disabled