在 npm 构建期间找不到模块 @restart/context/forwardRef [英] Cannot find module @restart/context/forwardRef during npm build

查看:81
本文介绍了在 npm 构建期间找不到模块 @restart/context/forwardRef的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在升级到较新版本的 react-bootstrap (1.0.0-beta.6).

I recently started having a problem with npm build after upgrading to newer version of react-bootstrap (1.0.0-beta.6).

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 命令,但这不是有效的包名称.有没有人知道如何在不回到旧版本的情况下解决这个问题(它不支持标签,这是我正在使用的东西)?

I tried running the provided yarn command but this is not a valid package name. Does anyone have an idea how to fix this without going back to the old version (which does not support tabs, which is something I am using)?

推荐答案

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

This is an upstream issue with @restart/context, which just released a version that breaks importing forwardRef like this:

import forwardRef from '@restart/context/forwardRef'

快速修复是通过运行 yarn add @restart/context@2.1.2 降级到 2.1.2.

Quick fix is to downgrade to 2.1.2 by running yarn add @restart/context@2.1.2.

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

Longer term fix is to wait for react-bootstrap to either fix their imports or lock their package.json to this version of @restart/context.

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

I added an issue to the react-bootstrap repo to track progress here: https://github.com/react-bootstrap/react-bootstrap/issues/3576

这篇关于在 npm 构建期间找不到模块 @restart/context/forwardRef的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆