Cannot find module @restart/context/forwardRef during npm build

喜欢而已 提交于 2019-12-24 06:05:04

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/55419787/cannot-find-module-restart-context-forwardref-during-npm-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!