当我开始运行本地服务器时出现以下错误:
无法编译./src/App.js未找到模块:无法解析 '/ home / sol / React / kuehnfotografie / src'中的'./Main'
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import Main from './Main';
import { Provider, createComponent } from 'react-fela';
import { createRenderer } from 'fela';
class App extends React.Component {
render() {
return (
<div className="content">
<Main />
</div>
);
}
}
export default App;
这是main.js文件:
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider, createComponent } from 'react-fela';
import { createRenderer } from 'fela';
import Header from './main/Header';
import Content from './main/Content';
import Footer from './main/Footer';
class Main extends React.Component {
render() {
return (
<div className="main">
<Header />
<Content />
<Footer />
</div>
);
}
}
export default Main;
答案 0 :(得分:0)
尝试删除
package-lock.json
,运行
npm安装
然后
npm运行
重新开始。