javascript - 找不到模块:无法解析“反应”
问题描述
我正在关注一个教程,突然间我收到了这个错误。我已经尝试了所有我能找到的解决方案,但没有成功
./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
推荐阅读
- c# - 无法在 Wix 项目中使用 ExeCommand 加密连接字符串
- vmware-clarity - 如何使用项目清晰度添加条形图和饼图
- unity3d - Unity3D:在遵循 3Dmodel 表面轮廓的三点之间绘制线
- qt - 无法在模拟器上运行 QT 基本示例
- xpath - 如何为 importxml 找到正确的 XPath 以在 Google 表格中导入此表?
- python - Numpy数字化错误:所需数组的深度太小
- python - 将 Python 变量值保存到 CSV 文件
- android - 在 Pie 微调器上没有显示数据以及社交媒体集成不起作用
- yii2 - Yii2 : 至少需要两个字段之一
- python - 为什么在我导入 NumPy 后 sum 的行为会有所不同