FortAwesome / react-fontawesome

Font Awesome React component
https://fontawesome.com
MIT License
3.68k stars 264 forks source link

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

Open ryuujo opened 5 years ago

ryuujo commented 5 years ago

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:\selfProject\faq-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.

Namchee commented 5 years ago

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

ryandrew14 commented 5 years ago

@Namchee is right, this is the problem.

ryuujo commented 5 years ago

Thanks @Namchee the problem has been solved! ^^

hridoyraisul commented 4 years ago

Thanks @Namchee the problem has been solved! ^^

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

robmadole commented 4 years ago

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

hridoyraisul commented 4 years ago

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

Thanks a lot ,, I fixed it

amastaneh commented 3 years ago

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

image

Afsana1313 commented 3 years ago

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'

robmadole commented 3 years ago

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

hasansiam45 commented 3 years ago

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

robmadole commented 3 years ago

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

NsdHSO commented 3 years ago

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.

robmadole commented 3 years ago

@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.

NsdHSO commented 3 years ago

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

srikanthch1919 commented 3 years ago

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\src\components' codeimg-facebook-shared-image

sergio-ivanuzzo commented 3 years ago

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

NsdHSO commented 3 years ago

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.

Ravindrakumara commented 3 years ago

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

hilminomad commented 3 years ago

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

Damemo commented 3 years ago

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.

ghost commented 2 years ago

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

jmartincc commented 2 years ago

Just wanted to say this worked for me, using Yarn, and it totally solved the issue. Thanks guys!

aliasr2001 commented 2 years ago

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

This Really Helped. Thanks Man 😄

oracularzebra commented 2 years ago

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

Thanks a lot I was searching on the web for 2 hours and yours just solved the problem.

Global-Manu-Man commented 2 years ago

excellent solution on problem

matheuscaet commented 1 year ago

My case was when I was using the version 6.0.0. I fixed change the version to a valid tag version here: https://www.npmjs.com/package/@fortawesome/fontawesome-svg-core In my case was 6.2.0

coffeecode27 commented 1 year ago

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

dude you saved my life

RinkaMizuki commented 1 year ago

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

Tks so much , you helped handle issue

ambasth05aruni commented 1 year ago

Hey I am facing the same issue. Screenshot 2023-03-25 121928

Kimiaghasemian commented 1 year ago

Module not found: Error: Can't resolve '@fortawsome/react-fontawsome' in 'C:\Users\User\Desktop\onlineshop\shop\src\components' i have this problem and i didnt fixed with npm i ........ could you help me pls?

ibams247 commented 7 months ago

Module not found: Error: Can't resolve '@fortawesome/free-brands-svg-icons' in 'C:\Users\amma\randoms-qoutes-mach\src\components' despite trying all the above npm commands I still get the above errors. kindly help

robmadole commented 7 months ago

@ambasth05aruni @Kimiaghasemian @ibams247 can you share your package.json files? Also, are you all using Vercel?

ibams247 commented 7 months ago

@robmadole i was able to resolve by re-creating the whole project. but the issue now is that I'm not able to install git in the project . I'm getting this error(npm ERR! A complete log of this run can be found in: C:\Users\amma\AppData\Local\npm-cache_logs\2024-02-17T04_35_10_377Z-debug-0.log)