Angular - FontAwesome 依赖项缺失错误
Angular - FontAwesome Dependencies missing error
我正在尝试在我的 angular 项目中安装 Font Awesome。在终端
中使用以下命令安装
ng add @fortawesome/angular-fontawesome@0.6
安装成功。现在它给出依赖错误。
The target entry-point "@fortawesome/angular-fontawesome" has missing dependencies:
- @fortawesome/fontawesome-svg-core
- @fortawesome/fontawesome-common-types
我检查了 package.json,这两个都存在。
我做错了什么?
按照@Yaroslav 的建议,我删除了 node_modules 文件夹和 运行 npm install。这解决了问题。
这是我所做的并且效果很好:
npm i font-awesome --save-dev
编辑angular.json,添加到"styles":
"./node_modules/font-awesome/css/font-awesome.css"
我知道我来晚了,但万一有人遇到同样的问题,我建议不要做任何事情,而是重新启动 angular 服务,这将基本上编译新添加的包以及这个问题的原因发生的是 angular cli 不编译包而服务是 运行
这里很晚,但我最近遇到了这个问题。这是我尝试命令 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
所以我按照警告中的消息进行操作,运行 接下来是这个命令。之后 angular 11 编译了 font-awesome 包,一切顺利
npm install @fortawesome/fontawesome-svg-core@^1.2.27 --save-dev
我正在尝试在我的 angular 项目中安装 Font Awesome。在终端
中使用以下命令安装ng add @fortawesome/angular-fontawesome@0.6
安装成功。现在它给出依赖错误。
The target entry-point "@fortawesome/angular-fontawesome" has missing dependencies: - @fortawesome/fontawesome-svg-core - @fortawesome/fontawesome-common-types
我检查了 package.json,这两个都存在。
我做错了什么?
按照@Yaroslav 的建议,我删除了 node_modules 文件夹和 运行 npm install。这解决了问题。
这是我所做的并且效果很好:
npm i font-awesome --save-dev
编辑angular.json,添加到"styles":
"./node_modules/font-awesome/css/font-awesome.css"
我知道我来晚了,但万一有人遇到同样的问题,我建议不要做任何事情,而是重新启动 angular 服务,这将基本上编译新添加的包以及这个问题的原因发生的是 angular cli 不编译包而服务是 运行
这里很晚,但我最近遇到了这个问题。这是我尝试命令 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
所以我按照警告中的消息进行操作,运行 接下来是这个命令。之后 angular 11 编译了 font-awesome 包,一切顺利
npm install @fortawesome/fontawesome-svg-core@^1.2.27 --save-dev