Vue JS - Unable to locate module (datepicker)

Today marks my first time delving into the world of vue.js, and as expected, I've encountered an error that has me stumped.

I recently incorporated the v-md-date-range-picker module into my project: (.

The setup instructions provided me with the following steps:

1

npm install --save v-md-date-range-picker

2

<template>
  <v-md-date-range-picker></v-md-date-range-picker>
</template>

3

<script>
import Vue from 'vue';
import VMdDateRangePicker from "v-md-date-range-picker";
import "v-md-date-range-picker/dist/v-md-date-range-picker.css";

Vue.use(VMdDateRangePicker);
</script>

After executing the terminal command in my project directory, inserting the necessary code snippets into my HelloWorld.vue page, and including the snippet from step 3 in my main.js, I checked my package.json file and saw:

"dependencies": {
  "core-js": "^2.6.5",
  "v-md-date-range-picker": "^2.6.0",
  "vue": "^2.6.10"
},

Despite this, an error message appeared:

Module not found: Error: Can't resolve 'v-md-date-range-picker/dist/v-md-date-range-picker.css' in '/Users/James/Documents/projects/vue-test/src'

Am I overlooking something obvious here?

Edit:

I attempted the suggested solution in the comments below to no avail.

While navigating through the module's main page, I discovered additional instructions:

I assume that you have a working bundler setup e.g. generated by the vue-cli thats capable of loading SASS stylesheets and Vue.js SFC (Single File Components).

I suspect that I may be lacking a functional bundler setup. Upon exploring the node_modules folder, specifically the module itself, I noticed the absence of a dist folder. Instead, only .scss files were present.

This leads me to believe that I need to build this project first.

How should I proceed?

My initial assumption was that running it in the browser would handle this automatically, but evidently, that is not the case.

Edit 2:

Following some online research, I came across the command:

$ npm run build. 

Executing this command resulted in the following error:

This dependency is not found, To install it, you can run: npm install --save v-md-date-range-picker/dist/v-md-date-range-picker.css

Running said command led me to encounter another error:

Could not install from "v-md-date-range-picker/dist/v-md-date-range-picker.css" as it does not contain a package.json file.

Answer ā„–1

Ensure that you check for the presence of this code snippet within the webpack.base.conf.js located in the build folder. If it is not there, make sure to add it.

module: {
    rules: [
      {
        test: /\.css$/,
        loader: ['style-loader', 'css-loader'], // Remember to maintain the order of loaders
      },

Before adding it to the file, execute

npm install style-loader css-loader --save
if they are missing.

To answer your specific query,

Execute the command: npm install sass-loader --save

Then, import each SCSS file into the module.

Although this may not be the most efficient solution, it seems like the package has issues, and this workaround is necessary.

I will take some time to personally evaluate the library and work on a possible fix for it.

Answer ā„–2

To set up the v-md-date-range-picker.css, go to the directory v-md-date-range-picker/dist/ and paste the CSS code from md-date-range-picker.min.css

After that, don't forget to refresh your page. It seems like the css file is not being generated properly when installing md-date-range-picker.min for some reason.

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

AngularJS $location Redirect Error: Property 'path' Undefined

I'm struggling with an issue in my AngularJS code where I am trying to change the URL without reloading the page when a submit button is clicked. However, I keep getting a TypeError: Cannot read property 'path' of undefined in the console. ...

Using JavaScript to detect the Facebook like button on a webpage

I am currently developing an application for Facebook using HTML and Javascript. My goal is to be able to detect when a user clicks the "Like" button on my company's Facebook page without needing to embed a separate "Like" button within my app itself. ...

The challenge of PHP's HTTP_REFERER

I am experiencing an issue with http_referer. In my setup, I have two files: index.php and index.html. The index.php file contains a form that, upon submission, includes information like the http_referer. On the other hand, the index.html file runs an aja ...

What could be causing the delay in response times from these unpredictable APIs within the Express server?

We are currently experiencing performance issues with our Express.js server and MongoDB database. Randomly, some API requests are taking too long to respond or timing out throughout the day. Our application is in production, hosted on two AWS instances wit ...

AngularJS encountered an unidentified provider: $routeProviderProvider

I've hit a roadblock with an unfamiliar provider error and can't seem to figure out what I'm missing. Here's the setup: in main.js 'use strict'; angular.module('myApp') .controller('MainCtrl', ['n ...

Vue Bootstrap toaster that magically disappears in an instant

My Vue Bootstrap Web-App (v2.21.2) is designed to utilize Toasts for displaying errors generated by the REST API client to users. When errors are caught in my components, a function is called that uses this.$bvToast.toast() to dynamically generate and dis ...

Unlocking the potential: Clicking on all ng-if elements with matching text using Chrome console

I am currently trying to determine how to automatically click on all elements that have a specific state. The page appears to be built using Angular, although I am unsure of the exact version being used. My approach involves using the console in Chrome t ...

What is the necessity for an additional item?

After exploring the Angular Bootstrap UI and focusing on the $modal service, I came across an intriguing discovery. In their demo at 'http://plnkr.co/edit/E5xYKPQwYtsLJUa6FxWt?p=preview', the controller attached to the popup window contains an i ...

Using AngularJS to create interactive popups within leaflet maps

My map uses leafletjs to create markers such as ev124, ev125, and so on. In addition, there are links with a key attribute like <a ng-click="popup(evsi)" key="124">link</a> Using angular, I extract the key value this way: $scope.popup= funct ...

Updating a string in JavaScript by dynamically adding values from a JSON object

In my current function, I am making a request to fetch data and storing it as an object (OBJ). Afterwards, I make another request to get a new URL that requires me to update the URL with values from the stored data. The information saved in the object is ...

Post request in ExpressJS fails to redirect user after submission

My current project involves developing a web application using NodeJS and ExpressJS. One issue I am encountering is with the login functionality on my website. After filling out the login form, the user's credentials are sent via a post request to the ...

Clicking on links will open them in a separate tab, ensuring that only the new tab

Is there a way to open a new tab or popup window, and have it update the existing tab or window whenever the original source link is clicked again? The current behavior of continuously opening new tabs isn't what I was hoping for. ...

Unlinking styles from the template in Vue.js

I have a unique situation where my template contains a <style> block that needs to be positioned near its corresponding div due to CMS restrictions. However, when I try to integrate Vue.js into the mix, it appears to strip out the style block and di ...

The error message "Unable to iterate over undefined property in Node.js using EJS and JavaScript" popped up

I've been struggling with the error "Cannot read property 'forEach of undefined" for two days now and I just can't seem to figure out the problem. Any help would be greatly appreciated. Here is the code: bruidstaart.js page where I am tryin ...

jQuery shorthand conditional statements

I currently have a jQuery function that is triggered by two separate buttons. $("#btnSearch, #btnDirectorSearch").click(function () { The construction of the HTML output within this function relies on which button was clicked. To accomplish this, I am ut ...

button that decreases in size when clicked on

Currently, I am dealing with an element that functions as a button using a combination of Javascript and CSS. To better illustrate the issue, I will simplify the example by removing unnecessary details. The main problem lies in the fact that when this elem ...

The CSS files are not loading automatically in my React application using Vite

I am facing an issue with importing css and js files into a view in React using vite. The styles are not loading properly, and I have to keep commenting and uncommenting the imports in my code for them to be recognized when entering the view. Below is a s ...

Troubleshooting a 404 error for an existing object: What to do?

I encounter a 404 'Not Found' error when attempting to edit a mark through my form. I am puzzled by the source of this error because in order to access this form, I require the brand ID (which can be found in the URL). Upon accessing my modifica ...

Preventing text from wrapping in a TypeScript-generated form: Tips and tricks

Iā€™m currently working on a ReactJS project and my objective is simple: I want all three <FormItem> components to be displayed in a single line without wrapping. However, I am facing the following output: https://i.stack.imgur.com/mxiIE.png Within ...

Employing the Quasar q-select feature with an active filter on a JSON object for its options

I'm having trouble finding examples using the composition API for this scenario and could really use some guidance. I have a q-select component that passes options as a prop through an axios request. The data is structured like this: [{description: "A ...