Error loading Vue.js: Failed to load resource: the server responded with a status of 404

Asked 1 years ago, Updated 1 years ago, 104 views

As for Vue.js, the js file is not loaded and it says {{message}} as it is now.
The following error occurs on the console:
I would like to display Hello Vue, what should I do?

Failed to load resource: the server responded with a status of 404 (Not Found)

app/javascript/packs/main.js

 var app = new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue'
  }
})

app/views/tops/index.html.erb

<divid="app">
  {{message}}
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js">/script>
<script src="../../javascript/packages/main.js"></script>

Vue.js Deployment Reference Articles

javascript ruby-on-rails vue.js


2022-09-30 15:04

1 Answers

I was able to load it with the following description.

<%=javascript_pack_tag'main'%>


2022-09-30 15:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.