Next-i18next: Cannot read property 'publicRuntimeConfig' of undefined

Created on 19 May 2020  路  1Comment  路  Source: isaachinman/next-i18next

Describe the bug

I'im trying to implement next-i18next in my project. No fancy config right now, it's basically taking the simple sample and putting it my project at the moment. Everything seems to be fine according to the sample. But when I run npm run dev, I have this error

> npm run dev

> [email protected] dev /mnt/e/Projects/next-i18n
> node server.js

/mnt/e/Projects/next-i18n/i18n.js:2
const { localeSubpaths } = require('next/config').default().publicRuntimeConfig;
                                                           ^

TypeError: Cannot read property 'publicRuntimeConfig' of undefined
    at Object.<anonymous> (/mnt/e/Projects/next-i18n/i18n.js:2:60)
    at Module._compile (internal/modules/cjs/loader.js:1176:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
    at Module.load (internal/modules/cjs/loader.js:1040:32)
    at Function.Module._load (internal/modules/cjs/loader.js:929:14)
    at Module.require (internal/modules/cjs/loader.js:1080:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/mnt/e/Projects/next-i18n/server.js:5:21)
    at Module._compile (internal/modules/cjs/loader.js:1176:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)

Occurs in next-i18next version

Module version is 4.4.2

Steps to reproduce

  • [ ] Clone this project (branch i18n)
  • [ ] Run npm install
  • [ ] Run npm run dev

Expected behaviour

The dev server should launch and translations should work

Screenshots

/

OS (please complete the following information)

  • Device: WSL with Ubuntu
  • Browser: /

Additional context

/

>All comments

Please post on StackOverflow. Good luck!

Was this page helpful?
0 / 5 - 0 ratings