Home
Support Forums

Next.js i18next language files Default namespace not found at /var/task/public/static/locales/en/common.json" problem

Hi, i use next.js i project deploy build is success . I get the following error when i enter the site
When I run the project on local computer and on vercel everything works fine but when I run it on netlify this error comes up

{"errorType":"Error","errorMessage":"Default namespace not found at /var/task/public/static/locales/en/common.json","trace":["Error: Default namespace not found at /var/task/public/static/locales/en/common.json"," at createConfig (/var/task/src/node_modules/next-i18next/dist/commonjs/config/create-config.js:117:19)"," at new NextI18Next (/var/task/src/node_modules/next-i18next/dist/commonjs/index.js:57:48)"," at Object.k7Sn (/var/task/src/netlify-automatic-functions/next_index/nextPage.js:4758:18)"," at __webpack_require__ (/var/task/src/netlify-automatic-functions/next_index/nextPage.js:23:31)"," at Module.1TCz (/var/task/src/netlify-automatic-functions/next_index/nextPage.js:301:63)"," at __webpack_require__ (/var/task/src/netlify-automatic-functions/next_index/nextPage.js:23:31)"," at Module.svS4 (/var/task/src/netlify-automatic-functions/next_index/nextPage.js:5024:22)"," at __webpack_require__ (/var/task/src/netlify-automatic-functions/next_index/nextPage.js:23:31)"," at /var/task/src/netlify-automatic-functions/next_index/nextPage.js:91:18"," at Object.<anonymous> (/var/task/src/netlify-automatic-functions/next_index/nextPage.js:94:10)"]}

this is i18n.js content:
const NextI18Next = require(“next-i18next”).default;
const { localeSubpaths } = require(“next/config”).default().publicRuntimeConfig;
const path = require(“path”);

module.exports = new NextI18Next({
otherLanguages: [“en”],
localeSubpaths,
localePath: path.resolve("./public/static/locales"),
//localePath: “public/static/locales”,
});

i18n language files folder tree:
-public > static >locales > en
-public > static >locales > de

Hey @devman,
Are you using the Next on Netlify build plugin? I know that we recently fixed some bugs related to localization. If you’re using the plugin directly from our plugins directory (app.netlify.com/plugins), we should automatically update it for you with the latest version, but if you’re including the plugin manually, you will have to update it yourself. Let us know if that helps or if there are followup questions.

Exactly the same problem here, latest Netlify plugin same config same error!

@devman any success on resolving that?

Hey there, @pecata :wave:

Can you tell us a little bit more about the issue you are encountering? It would be helpful if you could share with us:

  1. When this started
  2. Your netlify site name
  3. Your repo
  4. Your latest build log

Thank you!