Using vue-i18n in the vue project reports an error Cannot read properties of undefined (reading 'install')

Using vue-i18n in vue reports an error Cannot read properties of undefined (reading 'install')

Problem Description

In the vue2 project, vue-i18n is used to realize the multi-language switching function of the system. npm install --save vue-i18n shows that the installation is complete without any problems, but when it is introduced in main.js, an error is reported Cannot read properties of undefined (reading ' install')

solution

In the end, it was found that it was a version problem. npm install --save vue-i18n directly installed version ^9.x, but my vue/cli version was version 3.x, so uninstalled the installed vue-i18n version and reinstalled it 8.x version is enough

1. Uninstall the installed vue-i18n

npm uninstall vue-i18n

2. Reinstall the specified version of vue-i18n

npm install --save vue-i18n@8.0.0

Then import it normally

In addition, you can refer to my other article about the usage of vue-i18n to realize multi-language switching

The vue project uses vue-i18n to achieve multi-language switching

Guess you like

Origin blog.csdn.net/weixin_44490021/article/details/131538649
Recommended