Vue add i18n returns ERROR TypeError: Cannot read property 'minVersion' of undefined

Viewed 804

I try to run vue cli vue add i18n to generate localisation using i18n to my local. It got error

Done in 37.95s.

    ✔  Successfully installed plugin: vue-cli-plugin-i18n
    
     ERROR  TypeError: Cannot read property 'minVersion' of undefined
    TypeError: Cannot read property 'minVersion' of undefined
        at module.exports.pkg (/mnt/disks/data_disks/teja/localised/forexsignals/node_modules/vue-cli-plugin-i18n/prompts.js:5:26)
        at invoke (/usr/local/lib/node_modules/@vue/cli/lib/invoke.js:74:25)
        at process._tickCallback (internal/process/next_tick.js:68:7)

The i18n.js and other files aren't generated.

Otherwise, I want to try to add i18n manually using npm install then add the files manually, but stuck at editing vue.config.js, here below my vue.config.js shown


    var PrerenderSpaPlugin = require('prerender-spa-plugin')
    var path = require('path')
    var Renderer = PrerenderSpaPlugin.PuppeteerRenderer;
    
    
    module.exports = {
      configureWebpack: config => {
        if (process.env.NODE_ENV !== 'production') return
    
        return {
          plugins: [
            new PrerenderSpaPlugin(
              {
                staticDir: path.resolve(__dirname, 'dist'),
                routes: ['/', '/join-free-channel'],
                renderer: new Renderer({
                  headless: true
                })
              }
            ),
          ]
        }
      }
    }

I have installed prerendering for my vue app that updates my vue.config.js file, but still have no idea about how to add internationalisation to the app by editing vue.config.js

2 Answers

I recently had this problem, this is caused by the absence of the @vue/cli-shared-utils dependency. I'm not sure why it was not installed when installing vue-cli.

A quick solution to this problem is to install this dependency: npm i @vue/cli-shared-utils

After installing, run vue add i18n again and it should work fine.

I faced a similar problem. I saw this error after vue add i18n, but I think they are the same

TypeError: Cannot read property 'split' of undefined

So, I just removed the package-lock.json file and then executed vue add i18n again.

It worked for me.

Related