React-fontawesome: Module not found: Can't resolve '@fontwesome/react-fontawesome'

Created on 2 May 2019  路  21Comments  路  Source: FortAwesome/react-fontawesome

I got an error while importing FontAwesome.
Here's the error:

./src/routes/Home/Home.jsx
Module not found: Can't resolve '@fontwesome/react-fontawesome' in 'C:\selfProjectfaq-page\src\routes\Home'

This is my code (I just only importing it):

import React, { Component } from "react";
import { FontAwesomeIcon } from "@fontwesome/react-fontawesome";
import { faSearch } from "@fortawesome/free-solid-svg-icons";

import "./Home.css";

class Home extends Component {
  render() {
    return (
      <div className="home">
        <div className="container container-title">
...

I already tried to remove node_modules and yarn.lock and tried to re-install it again, but still have the same issue.

Most helpful comment

Try this is
npm i --save @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesome

All 21 comments

I think the import path is wrong. Shouldn't it be @fortawesome/<write module here> and not @fontwesome/<write module here>?

Refer to:
https://github.com/FortAwesome/react-fontawesome#installation

@Namchee is right, this is the problem.

Thanks @Namchee the problem has been solved! ^^

Thanks @Namchee the problem has been solved! ^^

please tell me how it solved? I have the same problem.

@hridoyraisul check the package namespace @fortawesome not @fontawesome "R" versus "N"

@hridoyraisul check the package namespace @fortawesome not @fontawesome "R" versus "N"

Thanks a lot ,, I fixed it

It's part of the NPM installation guideline in https://www.npmjs.com/package/@fortawesome/free-solid-svg-icons

image

I have faced the same issue. Even I used the folder name correctly as '@fortawesome', still, there is an error showing as 'Module not found: Can't resolve'

@Afsana1313 paste the error please and I'll take a look. I need to see if exactly.

still not solved.
this is my importing code:
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

@Afsana1313 @hasansiam45 please provide a reproducible example (something we can run npm install on) and we'll take a look.

Now I tried to introduce fontawesome myself. But I fail I tried to go after the installation and use guide. But it doesn't work out.

@NsdHSO you'll have to give us some additional details. If it doesn't match this issue ("Module not found: Can't resolve '@fontwesome/react-fontawesome'") then please open a new issue in this project.

@robmadole I configured it out, I had to give it an npm i. Tanks anyway.

I have faced the same issue. Even I used the folder name correctly as import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
this is the error:Module not found: Can't resolve '@fortawesome/react-fontawesome' in 'E:\react-music\srccomponents'
codeimg-facebook-shared-image

Faced with similar issue, for me helped to install @fortawesome/fontawesome-svg-core

Thanks i resolved this problem
YOU have a good day.聽

Faced with similar issue, for me helped to install @fortawesome/fontawesome-svg-core

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Try this is
npm i --save @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesome

Try this is
npm i --save @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesome
this one was very useful for the case

Faced with similar issue, for me helped to install @fortawesome/fontawesome-svg-core

Thanks, helped me resolve same issues in multiple files at once due to this.

After installing forntawsome globally by Command Prompt you have to install in your current working project singly.then it will work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lomse picture lomse  路  5Comments

Ethan-Arrowood picture Ethan-Arrowood  路  4Comments

jonathanazulay picture jonathanazulay  路  5Comments

jducro picture jducro  路  5Comments

v8tix picture v8tix  路  4Comments