Importing fontawesome library into React project. Still not working

I´ve trying for over an hour already I think…I´m following the instructions here:

https://github.com/FortAwesome/react-fontawesome

I do everything they ask, except when the engine renders:


import { faCoffee } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'



function App() {
  return (
    <div className="container">
      <div className="row">
        <div className="col-6">columna uno</div>
        <div className="col-6"><FontAwesomeIcon icon={faCoffee} /></div>
      </div>
    </div>
  );
}


It gives me this error:

./node_modules/@fortawesome/react-fontawesome/index.es.js
Module not found: Can't resolve '@fortawesome/fontawesome-svg-core' in 'C:\Users\milja\OneDrive\Documentos\react-testingspace\node_modules\@fortawesome\react-fontawesome'

However I check the node_modules folder and all it seems to be on point:

feef

I dont know what im missing.

If you have any other way to integrate fontawesome, please tell me. (in case i haven´t tried it yet)

1 Like

Is fontawesome-svg-core installed?

1 Like

Always read get started/installation section ;):

save @fortawesome/fontawesome-svg-core
$ npm i --save @fortawesome/free-solid-svg-icons
$ npm i --save @fortawesome/react-fontawesome

Install package again and check the error: why svg package is not found in react-font awesome? I guess you did a typo and import ‘svg blabla’ from react front awesome

1 Like

Well, shit, It worked. I just installed the package again like you said lol. Thanks