Ошибка вавилона: Модуль не найден: Не удается разрешить «/node_modules/react-scripts/node_modules/babel-loader/lib/index.js» после нового компонента

#reactjs #babel-loader

Вопрос:

Вывод дерева из src каталога:

 src/
├── App.css
├── App.js
├── App.test.js
├── components
│   └── layout
│       ├── About.js
│       ├── Header.js
│       ├── Hero.js
│       ├── References.js
│       └── Resume.js
├── img
│   ├── apple-touch-icon.png
│   ├── HMR.jpeg
│   ├── speaking.jpeg
│   ├── favicon.png
│   ├── nepal-bg.jpeg
│   └── testimonials-bg.jpeg
├── index.css
├── index.js
├── reportWebVitals.js
└── setupTests.js
 

References.js

 const References = () => {
    return (
        <div>
            <p>These are my refs</p>    
        </div>
    )
}

export default References
 

App.js

 import './App.css';
import Header from './components/layout/Header'
import Hero from './components/layout/Hero'
import About from './components/layout/About'
import Resume from './components/layout/Resume'
import References from './components/layout/References'

const App = () => {
  return (
    <div className='Container'>
      <Header />
      <Hero />
      <About />
      <Resume />
      <References />
    </div>
  );
}

export default App;

 

Сайт работает нормально, пока я не добавлю References.js файл в свой App.js файл. Я удалил node_modules и переустановил. Я установил предложенные пакеты npm. Я не могу понять, что приводит к нарушению изменений каждый раз, когда я пытаюсь добавить компонент.

Комментарии:

1. попробуйте запустить npm install , а затем npm start снова запустите приложение.

2. Это все исправило. Не могу поверить, что это все, что было, так как я несколько раз удалял и переустанавливал зависимости.

Ответ №1:

Удаление node_modules , остановка сервера, запуск npm i и перезапуск сервера с npm start устранением проблемы.