question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot set property 'locale' of undefined

See original GitHub issue

Version

v5.3.0

Reproduction link

Steps to reproduce

when development mode it’s ok, but when built and deployed it shown error.

What is expected ?

works properly

What is actually happening?

c6b25ed7d1e571a9b85f.js:1 [nuxt] Error while initializing app TypeError: Cannot set property 'locale' of undefined
    at f.<anonymous> (c6b25ed7d1e571a9b85f.js:1)
    at 33b42310abd05a803713.js:2
    at 33b42310abd05a803713.js:2
    at Array.forEach (<anonymous>)
    at 33b42310abd05a803713.js:2
    at f._withCommit (33b42310abd05a803713.js:2)
    at f.commit (33b42310abd05a803713.js:2)
    at f.commit (33b42310abd05a803713.js:2)
    at o.commit (33b42310abd05a803713.js:2)
    at f.setLocale (c6b25ed7d1e571a9b85f.js:1)

source code: https://github.com/nuxt-community/nuxt-i18n/blob/master/src/plugins/main.js#L41

wx20181230-005037 2x

state got undefined

Additional comments?

Config:

  modules: [
    ['nuxt-i18n', {
      locales: [
        { name: '简体中文', code: 'zh', iso: 'zh-CN', file: 'zh.js' },
        { name: 'English', code: 'en', iso: 'en-US', file: 'en.js' }
      ],
      lazy: true,
      langDir: 'locales/',
      strategy: 'prefix',
      defaultLocale: 'zh',
      detectBrowserLanguage: {
        useCookie: true,
        cookieKey: 'i18n_redirected'
      },
      rootRedirect: 'en',
      vueI18n: {
        fallbackLocale: 'en'
      }
    }]
  ],

deployed files: https://dev.tencent.com/u/willin/p/willin.wang/git/tree/master

  • ROOT
  • 404.html
  • zh/ folder
  • en/ folder
<div align="right">This bug report is available on Nuxt community (#c183)</div>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
rchlcommented, Aug 28, 2019

@sustained Can you also check with v6.0.2 just to establish whether it’s a recent regression or not?

Also, where is load state button in Vue Devtools? I couldn’t find that one but if I click Force refresh then whole Vue devtools kinda crash (stop reacting).

0reactions
sustainedcommented, Aug 28, 2019

image

image

image

[sustained@aurora nuxt-dynamic-markdown-example-project]$ cat node_modules/nuxt-i18n/package.json | grep '"version":'
  "version": "6.0.2"

@rchl

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot set property 'locale' of undefined · Issue #238 - GitHub
I get following error: Cannot set property 'locale' of undefined TypeError: Cannot set property 'locale' of undefined at Object.
Read more >
Cannot set property 'locale' of undefined, not working in replit ...
Repl.it is just not reading the sub-prototype 'locale' from your targetObject you should just try switching hosts :).
Read more >
TypeError: Cannot read property 'locale' of undefined - Forums
Hi! I have a very simple Lambda function (with default and basic configuration) that is throwing the following error.
Read more >
Cannot set property 'locale' of undefined got when input Enter ...
TypeError : Cannot set property 'locale' of undefined got when input Enter directly in console.
Read more >
Locale issue. Cannot read property 'replace' of undefined
We have been getting the above error and I am guessing it it because of the locale. What is the best way to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found