使用angular cli 6.0.5安装fontawesome抛出错误E418

时间:2018-05-28 21:32:51

标签: angular font-awesome

在Windows机器上执行命令'npm install --save @ fortawesome / fontawesome-free-regular'之后我得到了错误代码E418 - 我是一个茶壶:@ fortawesome-free-regular @ latest。

环境:

Angular CLI:6.0.5,节点:8.9.1,Os:win32 x64和Angular:6.0.3

我不明白这个错误代码的含义?可能是angular和fontawesome版本之间的代理或兼容性吗?

9 verbose stack Error: 418 I'm a teapot: @fortawesome/fontawesome@latest
9 verbose stack     at fetch.then.res (C:\dev\tools\node-v8.9.1-win-x64\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19)
9 verbose stack     at tryCatcher (C:\dev\tools\node-v8.9.1-win-x64\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
9 verbose stack     at Promise._settlePromiseFromHandler (C:\dev\tools\node-v8.9.1-win-x64\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
9 verbose stack     at Promise._settlePromise (C:\dev\tools\node-v8.9.1-win-x64\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
9 verbose stack     at Promise._settlePromise0 (C:\dev\tools\node-v8.9.1-win-x64\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
9 verbose stack     at Promise._settlePromises (C:\dev\tools\node-v8.9.1-win-x64\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
9 verbose stack     at Async._drainQueue (C:\dev\tools\node-v8.9.1-win-x64\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
9 verbose stack     at Async._drainQueues (C:\dev\tools\node-v8.9.1-win-x64\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
9 verbose stack     at Immediate.Async.drainQueues (C:\dev\tools\node-v8.9.1-win-x64\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
9 verbose stack     at runCallback (timers.js:789:20)
9 verbose stack     at tryOnImmediate (timers.js:751:5)
9 verbose stack     at processImmediate [as _immediateCallback] (timers.js:722:5)

1 个答案:

答案 0 :(得分:0)

对于这个错误,我觉得很有趣,我可以找到一些:explanation of the concept here 根据npm的官方回购,安装fortawesome的正确命令是:npm i @fortawesome/angular-fontawesome,或者你也可以使用纱线:yarn add @fortawesome/angular-fontawesome
你可以在下面的代码中看到如何使用它:

<head>
    <!--core first + styles last-->
    <link href="/static/fontawesome/fontawesome-all.css" rel="stylesheet">
</head>
<body>
    <!--user icon in two different styles-->
    <i class="fas fa-user"></i>
    <i class="far fa-user"></i>
    <!--brand icon-->
    <i class="fab fa-github-square"></i>
</body>