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:
- Created 4 years ago
- Comments:34 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
npm i swiper --save or yarn add swiper --save
and then: import { Swiper, SwiperSlide } from ‘vue-awesome-swiper’ import ‘swiper/swiper-bundle.css’
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 anpm i swiper --save
and it will work