Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relative module was not found in Vue.js when build project

Tags:

I have a project on Vue.js with Typescript and when I run dev server (prod build too) it returns error in console:

ERROR Failed to compile with 1 errors
This relative module was not found:

*./app.vue in ./src/main.ts

I alredy tried to checkout previous project commits, update global and local packages, clone and build project on other machines, delete and reinstall packages, delete package-lock.json, create new project via vue cli and add project files on new configuration - and nothing was changed. Same error. Very strange for me.

Here is my main.ts

import Vue from 'vue'; import App from './app.vue'; import router from './router'; import store from './store';  Vue.config.productionTip = false;  new Vue({   router,   store,   render: (h) => h(App) }).$mount('#app'); 

And here App.vue

<template>   <div id="app" class="container-fluid">     <header-component></header-component>     <main id="content" class="content row">       <transition name="fade">         <router-view/>       </transition>     </main>     <footer-component></footer-component>   </div> </template>  <script lang="ts"> import { Component, Vue } from 'vue-property-decorator'; import HeaderComponent from './components/header/header.component'; import FooterComponent from './components/footer/footer.component';  @Component({   components: {     HeaderComponent,     FooterComponent   } }) export default class App extends Vue {} </script>  <style lang="scss"> @import "../node_modules/bootstrap/dist/css/bootstrap.min.css"; @import "../node_modules/font-awesome/css/font-awesome.min.css"; @import "../node_modules/vue2-animate/dist/vue2-animate.min.css"; @import "./styles/main.scss"; </style> 

Thanks in advance for help.

like image 702
Dried09 Avatar asked May 30 '18 20:05

Dried09


2 Answers

It was a spelling error. I change

import App from './app.vue'; 

to

import App from './App.vue'; 

and it fix the error. Thanx to Derek for help

like image 147
Dried09 Avatar answered Sep 18 '22 10:09

Dried09


It could also be, because your node_modules, is not at the root of the project.

like image 28
Kevin.B Avatar answered Sep 18 '22 10:09

Kevin.B