12

When trying to run the application with npm run serve (on iOS), I am getting the following error:

This relative module was not found:

  • ./src/main.js in multi (webpack)-dev-server/client?http://10.0.0.5:8081/sockjs-node ./node_modules/@vue/cli-service/node_modules/webpack/hot/dev-server.js ./src/main.js

Please bear with me, I am new to this.

I have tried a bunch of random stuff like checking for misspelling issues, reinstalling webpack, updating node, and nothing. I have no clue of what this error is about so I am not sure where to look at.

The main.js file looks like this:

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/store'
import './registerServiceWorker'
import * as VueGoogleMaps from "vue2-google-maps"
import VeeValidate from 'vee-validate'
import BootstrapVue from 'bootstrap-vue'

Vue.use(VueGoogleMaps, {
    load: {
        key: "AIzaSyCGiy39IZbj8oxvO4HHqSVjP5RmLSHl7mY",
        libraries: "places" // necessary for places input
    }
});

Vue.use(VeeValidate);
Vue.use(BootstrapVue);

Vue.config.productionTip = false;

new Vue({
    router,
    store,
    beforeCreate() {
        this.$store.commit('initialiseStore');
        this.$store.dispatch('commons/initialize');
    },
    render: h => h(App)
}).$mount('#app')

I expect the live web server to display, but I am getting this compilation error and it is failing.

2
  • 1
    Might be a silly question but is main.js in the src directory? Did you create the project with Vue CLI? Commented Feb 13, 2019 at 2:03
  • 1
    Yes it is in the src directory, and this project was created by someone else and I downloaded the repository, the project was created with Vue CLU, but not by me. Commented Feb 14, 2019 at 23:05

3 Answers 3

6

I faced a similar issue after and spent hours searching.

The issue occurred in my project when I tried to install vuetify using command vue add vuetify. Apparently, the in automatically changes the app entry property in webpack.config automatically.

You can either change the filename itself to main.js or change the webpack config through vue.config.js (by reading the vue cli documentation regararding webpack config).

You can check your webpack.config by using the command vue inspect.

 ],
 entry: {
   app: [
    './src/main.js'
   ]
 }
}
Sign up to request clarification or add additional context in comments.

Comments

1

I had a similar error, this worked for me but not sure you have the same issue. I found this in one of my webpack configuration files (usually named like webpack.dev.conf.js):

{
  test: /\.js$/,
  loader: 'babel-loader',
  include: [
    resolve('src'), 
    resolve('test'), 
    resolve('node_modules/webpack-dev-server/client')
  ]
},

I removed resolve('node_modules/webpack-dev-server/client') and it fixed that issue.

Comments

0

This is an old thread, but I ran across this recently after installing a new module to a Vue project. The problem went away when I updated all my other modules, too.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.