question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fail to import swiper

See original GitHub issue
  • page error
Module not found: Error :can't resolve 'swiper/dist/css/swiper.css'
  • console warn
This dependency was not found:
* swiper/dist/css/swiper.css in ./src/main.js
To install it, you can run: npm install --save swiper/dist/css/swiper.css
  • npm install --save swiper/dist/css/swiper.css
npm ERR! code ENOLOCAL
npm ERR! Could not install from "swiper\dist\css\swiper.css" as it does not contain a package.json file.
  • source
import Vue from 'vue';
import VueAwesomeSwiper from 'vue-awesome-swiper';
import 'swiper/dist/css/swiper.css';
import App from './App.vue';
import router from './router';
import store from './store';
import './assets/css/reset.css';
import './assets/fonts/iconfont.css';
import 'lib-flexible';
Vue.config.productionTip = false;

Vue.use(VueAwesomeSwiper);
new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app');

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:34 (1 by maintainers)

github_iconTop GitHub Comments

31reactions
otabekoffcommented, Jul 24, 2020

npm i swiper --save or yarn add swiper --save

and then: import { Swiper, SwiperSlide } from ‘vue-awesome-swiper’ import ‘swiper/swiper-bundle.css’

30reactions
vesper8commented, Apr 26, 2020

For those scratching their head at this error. It’s because it’s not enough to just install vue-awesome-swiper, you have to explicitly also install the package swiper which wasn’t required in V3. Just do a npm i swiper --save and it will work

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Can't resolve 'swiper/css' - Stack Overflow
For swiper@7.3.1 , the imports in a Create-React-App project work this way - import React from 'react' import { Pagination } from 'swiper' ......
Read more >
Getting Started With Swiper
Installation. There are few options on how to include/import Swiper into your project: Install from NPM. We can install Swiper from NPM $...
Read more >
swiper - npm
Swiper. Swiper - is the free and most modern mobile touch slider with hardware accelerated transitions and amazing native behavior.
Read more >
Importing Swiper JS breaks everything - sage - Roots Discourse
I deduced that this had something to do with the Boostrap import conflicting somehow. I removed that and the error went away and...
Read more >
Help with swiperjs - import error : r/react - Reddit
npm i swiper. Here is my package.json: r/react - Help with swiperjs - import error. 3. Here is my code (just copied the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found