简体   繁体   中英

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 ).

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. 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:

import forwardRef from '@restart/context/forwardRef'

Quick fix is to downgrade to 2.1.2 by running 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 .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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