无法与 vue.js 一起使用 vue-awesome

Can't get vue-awesome working with vue.js

我正在使用 vue-cli (6.3.0)、node (10.8.0) 和 npm (6.3.0) 并使用本教程设置了一个基本项目 Build your first vue.js components 我是来添加 vue -太棒了

$ npm 安装 vue-awesome $ npm 安装

我可以看到 vue-awesome 已添加到 package.json

我有一个文件componets/rating.vue

<template>
  <div>
   <ul>
     <li><icon name="star"/></li>
     <li><icon name="star"/></li>
     <li><icon name="star"/></li>
     <li><icon name="star-o"/></li>
     <li><icon name="star-o"/></li>
   </ul>
   <span>3 of 5</span>
 </div>
</template>

<script>
import 'vue-awesome/icons/star'
 import 'vue-awesome/icons/star-o'

 import Icon from 'vue-awesome/components/Icon'

 export default {
   components: { Icon }
 }
</script>

和main.js是,

import Vue from 'vue'
import App from './App'
import router from './router'
import Rating from './components/Rating'
Vue.config.productionTip = false
new Vue({
  el: '#app',
  router,
  template: '<Rating/>',
  components: {
    Rating
  }
})

npm 运行 开发

给我这个错误,

ERROR Failed to compile with 1 errors
7:11:40 PM

This dependency was not found:

  • vue-awesome/icons/star-o in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/Rating.vue

To install it, you can run: npm install --save vue-awesome/icons/star-o

所以我运行 $ npm install --save vue-awesome/icons/star-o

这给了我

npm ERR! code ENOLOCAL npm ERR! Could not install from "vue-awesome/icons/star-o" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in: npm ERR!
/Users/shanegibney/.npm/_logs/2018-08-15T18_18_10_343Z-debug.log

如果您能就可能导致此问题的原因提供任何帮助,我们将不胜感激,

谢谢

你可以使用 regular/star :

<v-icom name='regular/star'></v-icon>