How to fix “Module not found: Can't resolve 'react'”?

我的未来我决定 提交于 2019-12-11 15:18:00

问题


I'm trying to get particlesjs to run in react. But that doesn't seem to work..So , I tried using react-particles-js .But it gives me this error: Module not found: Can't resolve 'react' in 'C:\Users\Amit\node_modules\particles-js\lib'

        import React, { Component } from 'react';

        import ParticleAnimation from 'particles-js';

         class Example extends Component {
            render () {
               return (
              <ParticleAnimation />
          )
        }
       }export default Example;

I've been trying to mess with the file path in the import statement but nothing has worked so far. Thank you for your time.


回答1:


try to install it again in you project ,

yarn add react

or

npm i react --save



来源:https://stackoverflow.com/questions/55416988/how-to-fix-module-not-found-cant-resolve-react

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