在升级到较新版本的 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
命令,但这不是有效的包名称。有谁知道如何在不返回旧版本(不支持标签,这是我正在使用的东西)的情况下解决这个问题?
最佳答案
这是 @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
仓库中添加了一个问题来跟踪进度:https://github.com/react-bootstrap/react-bootstrap/issues/3576
关于javascript - 在 npm 构建期间找不到模块 @restart/context/forwardRef,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55419787/