简体   繁体   English

在 npm 构建期间找不到模块 @restart/context/forwardRef

[英]Cannot find module @restart/context/forwardRef during npm build

I recently started having a problem with npm build after upgrading to newer version of react-bootstrap ( 1.0.0-beta.6 ).我最近在升级到较新版本的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.

I tried running the provided yarn command but this is not a valid package name.我尝试运行提供的yarn命令,但这不是有效的包名称。 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)?有没有人知道如何在不回到旧版本的情况下解决这个问题(它不支持标签,这是我正在使用的东西)?

This is an upstream issue with @restart/context , which just released a version that breaks importing forwardRef like this:这是@restart/context的上游问题,它刚刚发布了一个版本,该版本中断了像这样导入forwardRef

import forwardRef from '@restart/context/forwardRef'

Quick fix is to downgrade to 2.1.2 by running yarn add @restart/context@2.1.2 .快速修复是通过运行yarn add @restart/context@2.1.2降级到yarn add @restart/context@2.1.2

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修复它们的导入或将它们的package.json锁定到这个版本的@restart/context

Edit: I added an issue to the react-bootstrap repo to track progress here: https://github.com/react-bootstrap/react-bootstrap/issues/3576编辑:我在react-bootstrap库中添加了一个问题以在此处跟踪进度: https : //github.com/react-bootstrap/react-bootstrap/issues/3576

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM