问题
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