【问题标题】:Cannot install react-navigation and gestures无法安装反应导航和手势
【发布时间】:2021-01-01 06:51:00
【问题描述】:

安装时出现此错误

npm install react-navigation
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\fsevents):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'C:\Users\subba-workstation\Desktop\practise\ecommerceApp\node_modules\fsevents' -> 'C:\Users\subba-workstation\Desktop\practise\ecommerceApp\node_modules\.fsevents.DELETE'

npm ERR! code ENOENT
npm ERR! path C:\Users\subba-workstation\Desktop\practise\ecommerceApp\node_modules\hoist-non-react-statics
npm ERR! dest C:\Users\subba-workstation\Desktop\practise\ecommerceApp\node_modules\.hoist-non-react-statics.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\subba-workstation\Desktop\practise\ecommerceApp\node_modules\hoist-non-react-statics' -> 'C:\Users\subba-workstation\Desktop\practise\ecommerceApp\node_modules\.hoist-non-react-statics.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\subba-workstation\AppData\Roaming\npm-cache\_logs\2020-09-14T13_22_46_720Z-debug.log

【问题讨论】:

    标签: node.js reactjs react-native npm


    【解决方案1】:

    请尝试在项目控制台中使用 Yarn 命令安装它们:

    yarn add @react-navigation/native
    

    【讨论】:

    • 更多信息请阅读React Navigation's Documentation
    • 我是这个平台的新手,没有使用过yarn,担心npm和yarn可能会崩溃我想用npm来解决
    • 尝试使用 npm doctor 检查是否缺少依赖项,然后您可以轻松修复它们
    • 抱歉给您添麻烦了。问题是由于 react-navigation 版本 4 和 5,我按照使用版本 4 的教程进行操作,文档在版本 5 上。
    【解决方案2】:

    请按照以下步骤解决问题。

    1. npm cache clean -f
    2. remove node_module folder manually
    3. npm i

    【讨论】:

    • 从路径来看,是Windows系统。
    • 我试过了,但它导致了更多错误。很抱歉不再这样做了。
    猜你喜欢
    • 2020-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多