react-native - expo install react-native-svg“错误运行此命令会将依赖项添加到工作区根目录而不是工作区本身......”
问题描述
我正在使用世博会 CLI。我想在 React Native 中使用 SVG。所以,我按照这里的说明https://github.com/react-native-svg/react-native-svg。但是当我安装时,expo install react-native-svg
我收到以下错误:
expo install react-native-svg
> yarn add react-native-svg
yarn add v1.22.11
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).
yarnpkg exited with non-zero code: 1
Error: yarnpkg exited with non-zero code: 1
at ChildProcess.completionListener (C:\Users\85620\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:65:13)
at Object.onceWrapper (events.js:482:26)
at ChildProcess.emit (events.js:375:28)
at ChildProcess.cp.emit (C:\Users\85620\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1055:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
...
at Object.spawnAsync [as default] (C:\Users\85620\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:26:19)
at YarnPackageManager._runAsync (C:\Users\85620\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\package-manager\src\NodePackageManagers.ts:309:31)
at YarnPackageManager.addAsync (C:\Users\85620\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\package-manager\src\NodePackageManagers.ts:258:16)
at actionAsync (C:\Users\85620\AppData\Roaming\npm\node_modules\expo-cli\src\commands\installAsync.ts:55:12)
当我尝试这个命令时yarn add react-native-svg
,我收到了这个错误
yarn add react-native-svg
error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
有什么建议吗?我是 Expo 和 React Native 的新手。
解决方案
也许你应该使用 expo 命令
expo install react-native-svg
推荐阅读
- c# - 如何将带有 HTML 编码字符的法语单词大写?
- javascript - lastModified 返回“无效日期”
- sql - 没有主键,只有一个外键的表,外键可以重复吗?
- vbscript - 获取当前脚本的名称和路径
- javascript - 如何防止用户通过查询参数访问 JSON 数据?
- python-3.x - 我想了解 Python 预测模型
- javascript - 如何绘制箭头以通过 ngraph.pixi 与 PIXI.js 与 webgl 链接?
- rxjs - 向呼叫者公开主题,但在订阅量降至零时收到通知
- c++ - Visual Studio MFC C++“CFormView”从“基类”下拉列表中丢失
- r - 从数据框中删除两列中的值在 R 中不匹配的行