首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >expo install react-native-svg“运行此命令时会将依赖项添加到工作区根目录,而不是工作区本身...”

expo install react-native-svg“运行此命令时会将依赖项添加到工作区根目录,而不是工作区本身...”
EN

Stack Overflow用户
提问于 2021-08-11 06:59:40
回答 2查看 437关注 0票数 0

我正在使用Expo CLI。我想在React Native中使用SVG。所以,我遵循了这里的指令,https://github.com/react-native-svg/react-native-svg。但是当我安装expo install react-native-svg时,我收到了以下错误:

代码语言:javascript
复制
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)

Screenshot1

当我尝试这个命令yarn add react-native-svg时,我收到了这个错误

代码语言:javascript
复制
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.

Screenshot2

有什么建议吗?我是第一次接触世博会和React Native。

EN

回答 2

Stack Overflow用户

发布于 2021-08-11 07:11:15

也许你应该使用expo命令

代码语言:javascript
复制
expo install react-native-svg
票数 0
EN

Stack Overflow用户

发布于 2021-08-11 19:42:35

根据这个主题why does yarn warn when adding a dependency to the root workspaces package.json,现在我可以使用以下命令来安装它。

代码语言:javascript
复制
yarn workspace mobile-app add react-native-svg
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68737375

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档