3

I am trying to install Font Awesome in my angular project. Installed using the following command in terminal

ng add @fortawesome/angular-fontawesome@0.6

It installed successfully. Now it is giving dependency error.

The target entry-point "@fortawesome/angular-fontawesome" has missing dependencies: - @fortawesome/fontawesome-svg-core - @fortawesome/fontawesome-common-types enter image description here

I checked package.json and both of these exist there. enter image description here

enter image description here

What am i doing wrong?

Saad Bashir
  • 4,341
  • 8
  • 30
  • 60
  • It looks like something is messed up with node_modules or Angular CLI cache. Try removing node_modules and dist folder and re-running npm install or yarn install. Then try again. If you can reproduce this error using freshly generated Angular CLI project, please open an issue in https://github.com/FortAwesome/angular-fontawesome with the steps to reproduce the problem. – Yaroslav Admin Apr 26 '20 at 20:21

4 Answers4

3

As suggested by @Yaroslav, I deleted the node_modules folder and ran npm install. This fixed the issue.

Saad Bashir
  • 4,341
  • 8
  • 30
  • 60
3

I know I'm late but incase anybody struggling with the same issue I can suggest not to do anything but to restart the angular serve which will basically compile the new added packages and the reason why this issue happen is the angular cli doesn't compile the packages while the serve is running

  • 1
    You are correct. It works best when you shut down the angular server and then restart it after all installation is done. – sunitkatkar Jul 04 '21 at 23:27
1

here's what I do and it works well:

npm i font-awesome --save-dev

edit angular.json, add to "styles":

"./node_modules/font-awesome/css/font-awesome.css"
Rick
  • 1,710
  • 8
  • 17
-1

Quite late here, but I faced this issue very recently. This is the console output when I tried the command npm i font-awsome --save-dev

npm i font-awesome --save-dev
npm notice save font-awesome is being moved from dependencies to devDependencies
npm WARN @fortawesome/angular-fontawesome@0.8.2 requires a peer of @fortawesome/fontawesome-svg-core@^1.2.27 but none is installed. You must install peer dependencies yourself.
npm WARN karma-jasmine-html-reporter@1.6.0 requires a peer of jasmine-core@>=3.7.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ font-awesome@4.7.0
removed 1 package, updated 1 package and audited 1889 packages in 7.367s

138 packages are looking for funding
  run `npm fund` for details

found 21 vulnerabilities (20 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details

So I followed the message in the warning and ran this command next. After that angular 11 compiled the font-awesome packages and things went smooth

npm install @fortawesome/fontawesome-svg-core@^1.2.27 --save-dev
sunitkatkar
  • 1,958
  • 1
  • 14
  • 12