【问题标题】:Cannot find module @restart/context/forwardRef during npm build在 npm 构建期间找不到模块 @restart/context/forwardRef
【发布时间】:2019-08-20 12:48:42
【问题描述】:

在升级到较新版本的react-bootstrap (1.0.0-beta.6) 后,我最近开始遇到npm build 的问题。

Creating an optimized production build...
Failed to compile.

Cannot find module: '@restart/context/forwardRef'. Make sure this package is installed.
./node_modules/react-bootstrap/es/ThemeProvider.js

You can install this package by running: yarn add @restart/context/forwardRef.

我尝试运行提供的yarn 命令,但这不是有效的包名。有谁知道如何在不回到旧版本的情况下解决这个问题(不支持标签,这是我正在使用的东西)?

【问题讨论】:

    标签: javascript reactjs npm npm-install react-bootstrap


    【解决方案1】:

    这是@restart/context 的上游问题,它刚刚发布了一个破坏导入forwardRef 的版本,如下所示:

    import forwardRef from '@restart/context/forwardRef'
    

    快速解决方法是通过运行yarn add @restart/context@2.1.2 降级到 2.1.2。

    长期修复是等待react-bootstrap 修复其导入或将其package.json 锁定到此版本的@restart/context

    编辑:我在react-bootstrap repo 中添加了一个问题以在此处跟踪进度:https://github.com/react-bootstrap/react-bootstrap/issues/3576

    【讨论】:

      猜你喜欢
      • 2022-01-01
      • 1970-01-01
      • 2015-11-14
      • 2016-06-17
      • 2015-04-23
      • 2014-08-24
      • 2015-12-16
      • 2016-04-29
      • 2014-11-18
      相关资源
      最近更新 更多