Reputation: 987
Why am I getting that error
below in the browser? I just want to display the Flights
component in App
but I get that error
.
Why am I getting that error and how can I fix it?
Here's App.js
:
import React, { Component } from 'react';
import './App.css';
import Title from './components/Title/Title';
import Aux from './hoc/Aux';
import Flights from './components/Flights/Flights';
class App extends Component {
render() {
return (
<Aux>
<Title/>
<Flights/>
</Aux>
);
}
}
export default App;
Here's Flights.js
:
import React, { Component } from 'react';
import axios from 'axios';
class Flights extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
axios.get('https://api.spotify.com/v1/albums')
.then(response => {
console.log("API Call ====> " + response);
}).catch(error => {
console.log(error);
})
}
render() {
return(
<div>
<p>Here are the songs:</p>
</div>
);
}
}
export default Flights;
Here's the error I'm getting:
./src/components/Flights/Flights.js
Module not found: Can't resolve
'/Users/name/WebstormProjects/flights/node_modules/react-scripts/node_modules/babel-loader/lib/index.js' in
'/Users/name/WebstormProjects/flights'
Upvotes: 0
Views: 175
Reputation: 2826
It seems that you didn't install the babel-loader
into your project.
You have to install babel-loader into your devDependencies:
$ npm install --save-dev babel-loader
In case you're using Yarn
$ yarn add babel-loader
Or just run npm install
or yarn install
to install/update all packages you added to you package.json.
Upvotes: 1