When attempting to utilize vue-resource, I encountered the error message: "Uncaught TypeError: window.Vue.use is not defined."

As a newcomer to Vue.js, I recently attempted to incorporate vue-resource into my project only to encounter the following error:

Uncaught TypeError: window.Vue.use is not a function
   at vue-resource.js:1469
   at vue-resource.js:10
   at vue-resource.js:11 

The versions I am using are Vue 3.0.7 and vue-resource 1.5.2

Upon inspecting the vue-resource source code located in

node_modules/vue-resource/dist/vue-resource.js
, I found this snippet at line 1469:

    if (typeof window !== 'undefined' && window.Vue && !window.Vue.resource) {
      window.Vue.use(plugin);
    }

When testing window.Vue in the browser console at localhost:3000, it was defined but window.Vue.use was not.

At the end of my index.html file, the script tags include:

<!--some code -->
  <!-- Scripts -->
  <!-- adding hot reload -->
  <script src="/reload/reload.js"></script>
  <script src="node_modules/vue/dist/vue.global.js"></script>
  <script src="node_modules/vue-resource/dist/vue-resource.js"></script>
  <script src="public/script.js"></script>

</body>

</html>

In my methods property, the onSubmit() method for utilizing vue-resource is defined as follows:

            onSubmit() {
                console.log("Search");
                let path = "/search?q=".concat(this.search);
                this.$http.get(path)
                    .then(response => {
                        console.log(response);
                    });
            }

Answer №1

After conducting some research, I discovered that vue-resource does not offer support for Vue3. According to npmjs.com: It only supports Vue 1.0 & Vue 2.0. There is no mention of support for Vue3.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using JavaScript, ensure that the message "Do you really want to leave this page?" is displayed consistently

I need to implement a warning message that asks "Are you sure you want to leave this page?" whenever a user tries to navigate away from the page. I was able to achieve this using the window.beforeunload event. var warning = true; $(window).bind('befo ...

The post request fails to send certain variables

I'm experiencing an issue with a form that has rows structured like this: <div class="row unit" onmouseover="this.style.background = '#eeeeee';" onmouseout="this.style.background = 'white';" onclick="if(event.srcElement.nodeNam ...

What is the best method for testing different versions of the same module simultaneously?

My goal is to distribute a module across various component manager systems like npmjs and bower. I also want to provide downloadable builds in different styles such as AMD for requirejs, commonJS, and a global namespace version for browsers - all minified. ...

How to refresh the javascript cache in Laravel 5.8

I developed a company profile website using Laravel 5.8 and Vue.js to make it reactive, although it's not a single page application (SPA), we can refer to it as a hybrid. The website runs smoothly locally; however, after modifying the JavaScript code ...

What are the practical uses for lodash's "nth" method?

When working with complex nested arrays, the lodash function _.nth(array, n) provides a more structured and easier to read approach in accessing specific elements. Although using array[n] may seem more concise in simple cases, the lodash function can be mo ...

It is impossible to resolve Npm vulnerabilities

My journey with learning React began when I decided to create my first app using the command: 'npx create-react-app my-app' However, upon building the app, I encountered a warning in the terminal: 22 vulnerabilities (9 moderate, 13 high) In ...

The onChange function in React JS for a Material UI 'number' TextField retains the previous value

In this element, I have an onChange function: <TextField id="rowinput" type="number" defaultValue={this.defaultRows} // defaultRows = 1 inputProps={{ min: "1", max:"5"}} onChange= ...

Navigating through content on a screen can be accomplished in two

Is it feasible to incorporate both horizontal and vertical scrolling on a website using anchor tags? I recently created a website with horizontal scrolling for each main page. Within some of these main pages, there are subsections that I would like to hav ...

Internet Explorer IE 11 encounters an "Error: Object does not support property or method" issue

Recently, I started using the jquery circleChart.min.js plugin for creating a circle chart. It's been working perfectly on all browsers except for Internet Explorer 11 (IE11). I keep getting an error message when trying to run it in IE11. Can anyone h ...

What is the best way to access the index in a v-for loop in Vue.js?

Here is an example of my Vue component: <div v-for="item in items" :key="I need to access the index of the for-loop here" > </div> ... data(){ items: [{name:'a'}, {name:'b'}...] } Is there a way to retrieve the inde ...

The process of invoking a function within another function in TypeScript Angular

Just starting out with Angular 2, I've written the following code in my Angular project: export class TestClass { constructor() { this.initMap(); } initMap() { this.marker.addListener('dragend', this.onMarkerDr ...

Identical code exhibiting varying behavior between localhost:3000 and the production server at localhost:5000 on the web

I'm currently in the process of learning React Js, but I've been encountering a persistent error that has me stumped. A specific component functions perfectly when running on my local server (localhost:3000), but as soon as I try to deploy it to ...

AngularJS - Sending configuration values to a directive

I'm trying to figure out how to pass parameters (values and functions) to an Angular directive. It seems like there should be a way to do this in Angular, but I haven't been able to locate the necessary information. Perhaps I'm not using th ...

Prevent Dehydration issue while using context values in Next Js

Every time I log in with a user, update a context value, and re-render some components, I keep encountering a Hydration error in Next Js. The issue seems to be specifically with my NavBar component which is rendered using react-bootstrap. The code snippet ...

Trouble with mobile compatibility for .json file content population in HTML elements script

Check out THIS amazing page where I have a series of placeholders for phone numbers in the format: 07xxxxxxxx. By simply clicking the green button "VEZI TELEFON", each placeholder in the green boxes gets replaced with a real phone number from a JSON file u ...

The concept of undefined functions and the use of dependency injection may not always align

Recently starting with AngularJs, I am honing my skills by developing a single page Todo Application. However, I have encountered an issue while trying to load a localStorage factory that I intend to use for this project. Currently, I am stuck on the error ...

Exploring the integration of Glide js within a Next js environment

I am trying to figure out how to use a script tag in the next JavaScript _app.js component for utilizing the Glide JavaScript carousel. However, I am facing difficulties in using the script tag. Can someone help me out by providing guidance on how to inc ...

Fixing Half Screen Sidebars

I have a query regarding my coding problem. I am trying to create two pop-ups that occupy half of each screen. As I am new to JavaScript and jQuery, I want to ensure that I am doing it correctly. Is there a way for the left side to slide out from the left ...

Material UI fails to display any content

I attempted to integrate a navbar into my website, but React is not displaying anything. Even creating a new project did not resolve the issue. Additionally, Stack Overflow restricts posts that contain mostly code and I am unsure why. Here is my App.js im ...

Mapping the Way: Innovative Controls for Navigation

Currently, I am utilizing the HERE maps API for JavaScript. However, I would like to customize the design of the map controls similar to this: Below is an example for reference: HERE EXAMPLE Is it feasible to achieve this customization? ...