microapps / gatsby-plugin-react-i18next

Easily translate your Gatsby website into multiple languages
MIT License
121 stars 72 forks source link

Can't build site on development. Error: can't resolve 'browser-lang' in '.../node_modules/gatsby-plugin-react-i18next/dist/plugin' #161

Open MrFacundo opened 1 year ago

MrFacundo commented 1 year ago

Hi, I have that error message when trying to build on development mode.

I've tried installing packages "browser-lang" and "i18next-browser-languagedetector" via npm. I've also deleted node_modules, package-lock.json, run npm install, npm update, gatsby clean and the error persists.

This is in package.json:

"dependencies": { "@fortawesome/free-brands-svg-icons": "^6.2.0", "browser-lang": "^0.2.0", "browser-monads": "^1.0.0", "classnames": "^2.3.2", "eslint": "^8.24.0", "gatsby": "^4.24.2", "gatsby-omni-font-loader": "^2.0.2", "gatsby-plugin-image": "^2.24.0", "gatsby-plugin-less": "^6.24.0", "gatsby-plugin-manifest": "^4.24.0", "gatsby-plugin-react-i18next": "^2.0.5", "gatsby-plugin-sass": "^5.24.0", "gatsby-plugin-sharp": "^4.24.0", "gatsby-source-filesystem": "^4.24.0", "gatsby-transformer-sharp": "^4.24.0", "gsap": "^3.11.3", "i18next": "^21.10.0", "i18next-browser-languagedetector": "^6.1.8", "less": "^4.1.3", "less-loader": "^11.0.0", "locomotive-scroll": "^4.1.4", "node-sass": "^7.0.3", "react": "^18.2.0", "react-device-detect": "^2.2.2", "react-dom": "^18.2.0", "react-helmet": "^6.1.0", "react-i18next": "^11.18.6", "react-loadable": "^5.5.0", "react-responsive": "^9.0.0" },

Any ideas on how to solve this issue?

driuqzy commented 1 year ago

+1

Noticed:

  1. This repo updated the dep to 0.2.0 today https://github.com/microapps/gatsby-plugin-react-i18next/commit/8b3c3f103cb0f4819ff5a64595ebdf1ae152b5b9

  2. browser-lang just released 0.2.0 last week: https://github.com/wiziple/browser-lang/commit/81e55e2d8654936903d75a9ad6162dbc9d59d445

MrFacundo commented 1 year ago

Many thanks for the reply. I see now the issue is somehow related to an update. However, it's not really clear to me how should I proceed. I've already installed the current versions of both this repo and browser-lang dependency. My package.json says I've "browser-lang": "^0.2.0" installed and package-lock.json says:

   "gatsby-plugin-react-i18next": {
      "version": "2.0.5",
      "resolved": "https://registry.npmjs.org/gatsby-plugin-react-i18next/-/gatsby-plugin-react-i18next-2.0.5.tgz",
      "integrity": "sha512-Nb37hBsHZwu7utply3dHWhJiNmCf871FMfB716Bb6RIuYl1+bvYqxQvcVHWLVdPQ/v3nI2ruqRP6jrJfMFbPcA==",
      "requires": {
        "bluebird": "^3.7.2",
        **"browser-lang": "^0.2.0",**
        "outdent": "^0.8.0",
        "path-to-regexp": "^6.2.0",
        "react-helmet": "^6.1.0"
      },

So, I understand gatsby-plugin-react-i18next and browser-lang should be good pals, at least in these versions of themselves.

Should I maybe try to install an older version of this repo?

EDIT: I've installed version 2.0.4 and successfully created a development build

driuqzy commented 1 year ago

Same here, 2.0.4 works.