[英]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.