javascript - Vuetify 现有项目生成错误

标签 javascript vue.js vuetify.js vuejs3

我正在尝试在我的 vue 3 应用程序上下载 vuetify 3,但它给了我这个错误。我尝试过 npm install --save @popperjs/core vuetify/styles 但它不起作用。 我想知道这背后的原因是什么,我知道它仍处于测试阶段,但应该是稳定的。

Failed to compile with 2 errors

These dependencies were not found:

  • @popperjs/core in ./node_modules/bootstrap/dist/js/bootstrap.esm.js
  • vuetify/styles in ./src/plugins/vuetify.js

To install them, you can run: npm install --save @popperjs/core vuetify/styles Error from chokidar (C:): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp' Terminer le programme de commandes (O/N) ? O

npm install --save @popperjs/core vuetify/styles
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e0878994a0878994889582ce838f8d" rel="noreferrer noopener nofollow">[email protected]</a>/vuetify/styles.git
npm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3a5d534e7a5d534e524f5814595557" rel="noreferrer noopener nofollow">[email protected]</a>: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\PC\AppData\Local\npm-cache\_logs\2022-03-28T19_25_57_260Z-debug-0.log

最佳答案

vuetify/styles 不是 NPM 软件包,因此不要尝试安装它。 vuetify 是包名,styles 包含在 vuetify 中。

在 Vite 项目中安装 Vuetify 3:

  1. 安装 vuetify 3.x(当前位于 next 标记中):

    npm i -S vuetify@next
    
  2. 安装 @vuetify/vite-plugin作为开发依赖项:

    npm i -D @vuetify/vite-plugin
    
  3. 配置 Vite 使用上面的插件:

    // vite.config.js
    import { defineConfig } from 'vite'
    import vue from '@vitejs/plugin-vue'
    import vuetify from '@vuetify/vite-plugin' 👈
    
    export default defineConfig({
      plugins: [
        vue(),
        vuetify() 👈
      ],
    })
    
  4. 创建一个 Vuetify 插件实例,并将其安装在您的 Vue 应用中:

    // plugins/vuetify.js
    import { createVuetify } from 'vuetify'
    import 'vuetify/styles'
    
    export default createVuetify()
    
    // main.js
    import { createApp } from 'vue'
    import App from './App.vue'
    import vuetify from './plugins/vuetify'
    
    createApp(App)
      .use(vuetify) 👈
      .mount('#app')
    

demo

关于javascript - Vuetify 现有项目生成错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71652784/

相关文章:

javascript - 强制折叠 Vuetify v-list-group 中的所有事件项目

javascript - vue.js 与 vuetify : Can't load google map in mounted

vue.js - Vuetify v-text-field 更改值

javascript - 在动态输入数据的下拉菜单中设置默认值

javascript - 将node.js服务器的数据显示到html页面

javascript - 无法获得 Ajax 响应

vue.js - 在运行时更改 Vuetify 2 中主题的主要文本颜色

vue.js - 无法在 Vuex 中的其他 Action 中反跳 Action

javascript - Vue 如何在加载数据填充工作表之前将文本作为 v-card 中的占位符?

javascript - 更改 iframe 内图像的元素样式