Home > Net >  Please how can I fix this error in my react app
Please how can I fix this error in my react app

Time:05-23

Module not found: Error: Can't resolve '@fortawesome/fontawesome-svg-core' in 'C:\Users\ANNOH\Desktop\React_Portfolio\react-portfolio\node_modules@fortawesome\react-fontawesome' ERROR in ./node_modules/@fortawesome/react-fontawesome/index.es.js 1:0-64 Module not found: Error: Can't resolve '@fortawesome/fontawesome-svg-core' in 'C:\Users\ANNOH\Desktop\React_Portfolio\react-portfolio\node_modules@fortawesome\react-fontawesome'

webpack compiled with 1 error

import { Link, NavLink } from 'react-router-dom'
import './index.scss'
import LogoS from '../../assets/images/logo-s.png'
import LogoSubtitle from '../../assets/images/logo_sub.png'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faHome } from '@fortawesome/free-solid-svg-icons'

const Sidebar = () => (
    <div className='nav-bar'>
     <Link className='logo' to='/'>
        <img src={LogoS} alt="logo" />
        <img className='sub-logo' src={LogoSubtitle} alt="slobodan" />
     </Link>
    <nav>
        <NavLink exact="true" activeclassname="active" to="/" >
            <FontAwesomeIcon icon={faHome} color="#4d4d4e" />
        </NavLink>
    </nav>
  </div>
 )
 
export default Sidebar

CodePudding user response:

Typical spelling mistake. Rename @fortawesome to @fontawesome.

CodePudding user response:

That's because you didn't install node modules from package.json. If you use npm you have to do npm install. Or if you use yarn you have to do yarn install. If you already installed node_modules from package.json, then if you still have the issue, I suggest to delete node_modules directory and redo npm install or yarn install

  • Related