Saad Bashir
Saad Bashir

Reputation: 4519

Angular - FontAwesome Dependencies missing error

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

ng add @fortawesome/[email protected]

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?

Upvotes: 3

Views: 10824

Answers (4)

sunitkatkar
sunitkatkar

Reputation: 2086

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/[email protected] requires a peer of @fortawesome/fontawesome-svg-core@^1.2.27 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] 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: [email protected] (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ [email protected]
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

Upvotes: -1

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

Upvotes: 3

Rick
Rick

Reputation: 1870

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"

Upvotes: 1

Saad Bashir
Saad Bashir

Reputation: 4519

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

Upvotes: 3

Related Questions