代码之家  ›  专栏  ›  技术社区  ›  Danyx

Nuxt-未找到此依赖项

  •  0
  • Danyx  · 技术社区  · 4 年前

    我有一个简单的Nuxt项目,我正在工作,我安装了 Vue Icons 并试图将搜索图标添加到我的组件中,但编译时出现以下错误:

    This dependency was not found:                                                                                                                                                 
                                                                                                                                                                                   
    * @vue-icons/feather in ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./components/SiteHeader.vue?vue&type=script&lang=js&       
                                                                                                                                                                                  
    To install it, you can run: npm install --save @vue-icons/feather   
    

    但我已经在src和functions文件夹(我在firebase上托管)上安装了它

    "dependencies": {
      "@nuxtjs/firebase": "^7.6.1",
      "@vue-icons/feather": "^1.0.19",
      "firebase": "^8.9.1",
      "isomorphic-fetch": "^3.0.0",
      "nuxt": "^2.0.0"
    }
    

    我使用的进口声明是直接从网站上复制的

    import { SearchIcon } from "@vue-icons/feather";
    

    我读过一些类似的问题 transpiling the library ,但这似乎不起作用,我需要将第三方库添加到nuxt的其他部分吗。配置文件?

    0 回复  |  直到 4 年前
        1
  •  0
  •   kissu    4 年前

    我将引用文档中的内容

    该项目旨在重组[…]Vue 3常用图标包。

    Nuxt2与Vue3不兼容。

    如果你想使用完全相同的 vue-feather-icons 图书馆,请使用 this package 为了这个目的。

    它应该尽可能容易地工作

    <template>
      <div>
        <ActivityIcon />
      </div>
    </template>
    
    <script>
    import { ActivityIcon } from 'vue-feather-icons'
    
    export default {
      components: {
        ActivityIcon
      }
    }
    </script>
    

    否则,我也可以推荐 unplugin-icons 这将提供更多,而且非常灵活。它也完全包含 the icons you're looking for .

    很棒的软件包,不需要在其他功能的基础上查找工作包,就可以解决所有烦人的问题。

    推荐文章