簡體   English   中英

找不到此依賴項:*swiper/vue 如何修復?

[英]This dependency was not found: *swiper/vue how to fix?

我抓耳撓腮,因為我運行了npm i swiper並通讀了 Swiper Vue 文檔,它說import { Swiper, SwiperSlide } from 'swiper/vue我已經完成了,我什至得到了顯示95.4K (gzipped: 28.9K)

當我運行npm run serve我然后得到這個錯誤

This dependency was not found:

* swiper/vue in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/views/Home.vue?vue&type=script&lang=js

To install it, you can run: npm install --save swiper/vue

我終生無法弄清楚如何導入這種依賴性。

這對我有用,使用 Vue ^3.0.0 和 Swiper ^8.0.6

import { Swiper, SwiperSlide } from "swiper/vue/swiper-vue";

import "swiper/swiper-bundle.css";

如果您使用的是 swiper 版本 7*,那么您可能會遇到此類問題。

Github 問題 4871

嘗試降級到 v6.7.5,看看是否有幫助。

相關問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM