Search code examples
javascriptnuxt.jsnuxt-i18n

Can not use nuxt-i18n (version 5.4.2)


In my Nuxt.js application, I want to use the newest version (5.4.2) of nuxt-i18n. I used it previously without any problems, but I do not understand what is going wrong now:

Version

v5.4.2

Reproduction link

https://github.com/begueradj/nuxti18nerror

Steps to reproduce

  1. Either clone my project and follow the README file instructions
  2. Or create the a Nuxt.js project: yarn create nuxt-app my-project, then install the plugin: yarn add nuxt-i18n , then add it to the configuration file nuxt.config.js as the official documentation says: modules: [ ['nuxt-i18n', { // Options }] ]

What is expected ?

I expect to launch the server without errors when I run yarn run dev. As simple as that.

What is actually happening?

When I run yarn run dev I am getting this error message:

 INFO  Building project

✖ fatal /home/begueradj/nuxti18nerror/node_modules/nuxt-i18n/src/helpers/components.js:1
  Error: Cannot find module 'acorn-walk'
  at Object.<anonymous> (/home/begueradj/nuxti18nerror/node_modules/nuxt-i18n/src/helpers/components.js:5:16)
  at Object.Module._extensions..js (module.js:664:10)
Nuxt Fatal Error :(
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Solution

  • For anyone stumbling on the same issue, my boss solved the problem as soon as I informed him about it:

    yarn add acorn-walk
    

    (I think the solution is self explanatory)

    Update:

    This is officially fixed now.