繁体   English   中英

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

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

我尝试运行 vue cli vue add i18n以使用 i18n 生成本地化到我的本地。 出错了

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)

不会生成i18n.js和其他文件。

否则,我想尝试使用npm install手动添加 i18n 然后手动添加文件,但卡在编辑vue.config.js ,这里显示了我的vue.config.js


    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
                })
              }
            ),
          ]
        }
      }
    }

我已经为更新我的vue.config.js文件的 vue 应用程序安装了预渲染,但仍然不知道如何通过编辑vue.config.js向应用程序添加国际化

我最近遇到了这个问题,这是由于缺少@vue/cli-shared-utils依赖引起的。 我不确定为什么在安装vue-cli时没有安装它。

这个问题的一个快速解决方案是安装这个依赖: npm i @vue/cli-shared-utils

安装后,再次运行vue add i18n应该可以正常工作了。

我遇到了类似的问题。 我在vue add i18n之后看到了这个错误,但我认为它们是一样的

TypeError: Cannot read property 'split' of undefined

所以,我只是删除了package-lock.json文件,然后再次执行vue add i18n

它对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM