Jest fails with error: Cannot find module 'react/lib/ReactComponentTreeHook'

前端 未结 4 1365
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-05 13:34

I have installed Jest v17.0.3 in my react project.

When I run jest locally it works fine, but on the build server it fails with:

Error: Cannot fin

4条回答
  •  天命终不由人
    2021-02-05 14:02

    use same version of react and react-dom. My problem fixed after using this command

    npm install --save react@15.4.0 react-dom@15.4.0
    

    this problem specially occurs on react 15.4.0 above.

提交回复
热议问题