5

I got following error when I start to run the local server:

Failed to compile ./src/App.js Module not found: Can't resolve './Main' in '/home/sol/React/kuehnfotografie/src'

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;

Folder structure

This is the main.js file:

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;

13
  • Main is a folder not file, so either it should be ./main or Main folder should contain the index.js file. Commented Feb 13, 2018 at 12:51
  • I've a folder called "Main" and a file calles "main.js" Commented Feb 13, 2018 at 12:53
  • you want to render main.js file or any file inside Main folder?? Commented Feb 13, 2018 at 12:53
  • 1
    I want to render main.js ... your comment solved the problem. (changed it to ./main) Thanks, but now I got the same issue with main.js and so on. Never ends. Commented Feb 13, 2018 at 12:56
  • 1
    I got it. There were so many declarationproblems like it never stops to throw out a failure. Thank you so much for the help :) Commented Feb 13, 2018 at 13:45

2 Answers 2

1

Try to remove

package-lock.json

, run

npm install

and then

npm run

start again.

Sign up to request clarification or add additional context in comments.

1 Comment

This does not help.
0

Don't remove package-lock.json unless it's your last resort,.. this can(sometimes) cause more problems. I got this from another post >> Deleting `package-lock.json` to Resolve Conflicts quickly

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.