Home > other >  Module not found: Error: Can't resolve 'vue-csv-import'
Module not found: Error: Can't resolve 'vue-csv-import'

Time:09-02

I need to import vue-csv-import for vue 2. Added it using this command,

npm install [email protected]

package.json has updated has this,

"dependencies": {
   "vue-csv-import": "^3.3.8",

package-lock.json has updated too..

"vue-csv-import": {
      "version": "3.3.8",
      "resolved": "https://registry.npmjs.org/vue-csv-import/-/vue-csv-import-3.3.8.tgz",
      "integrity": "sha512-zYunaurbiOSd5zYuSFJDLo4jrQq2Kin2gbATdjSsDXlOGS4mTjLf0eIFhuIeyNiHwjCKLKaNGaQIILYxT5DwpA==",
      "requires": {
        "axios": "^0.21.1",
        "core-js": "^3.8.1",
        "lodash": "^4.17.20",
        "mime-types": "^2.1.27",
        "papaparse": "^5.3.0",
        "vue": "^2.6.12"
      }
    },

I tried npm cache clean --force too. And I'm running server with this command.

npm run serve

And import like,

import { VueCsvImport } from 'vue-csv-import';

But getting this error finally

Module not found: Error: Can't resolve 'vue-csv-import'

CodePudding user response:

looks like the component author has a little _whoopsie doodle_™ in the some of the vue2 versions where the component is not actually built.

You can try an older version like 3.3.5 or newer like 3.3.10 which has the component built and available in the /dist directory

npm install [email protected]

alternatively, if you need that version, you could try building it yourself, but that adds to the complexity.

By this fiddle which is working we can find version '3.3.5'

  • Related