[英]Module not found: Can't resolve 'react '
我正在学习一个教程,突然间我收到了这个错误。 我已经尝试了我能找到的所有解决方案,但没有成功
./src/Components/Views/Dashboard/Notification.js 未找到模块:无法解析“C:\\Users....\\Dashboard”中的“react”
我已经尝试过这些解决方案: 如何解决“找不到模块:无法解析‘反应’”?
https://github.com/facebook/create-react-app/issues/2534
仪表板.js
import React, { Component} from 'react'
import Notifications from './Notification'
import ProjectList from '../Projects/ProjectList'
class Dashboard extends Component {
render() {
return(
<div className="dasboard container">
<div className="row">
<div className="col s12 m6">
<ProjectList />
</div>
<div className="col s12 m5 offset-m1">
<Notifications />
</div>
</div>
</div>
)
}
}
通知.js
import React from 'react '
const Notifications = () => {
return(
<div className="container">
<p>Nostifications</p>
</div>
)
}
export default Notifications
这可能无济于事,但您有一些错别字。 我不确定它是否只是在 SO 上发布,但试试这个
仪表板.js
import React, { Component} from 'react'
import Notifications from './Notification' // Notification that you're importing isnt the same as the import name - Notifications from Notifications not Notification
import ProjectList from '../Projects/ProjectList'
class Dashboard extends Component {
render() {
return(
<div className="dasboard container">
<div className="row">
<div className="col s12 m6">
<ProjectList />
</div>
<div className="col s12 m5 offset-m1">
<Notifications />
</div>
</div>
</div>
)
}
}
通知.js
import React from 'react ' // <- there is a space here after the react import try taking it out
const Notifications = () => {
return(
<div className="container">
<p>Nostifications</p>
</div>
)
}
export default Notifications
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.