lobe-chat
lobe-chat copied to clipboard
[Bug] Error: Cannot find module './en-us.js'
📦 Environment
Other
📌 Version
1.8.2
💻 Operating System
Ubuntu
🌐 Browser
Chrome
🐛 Bug Description
Locally deploying an instance of lobe-chat using the pnpm install
method leads to an error pop up on the frontend:
Unhandled Runtime Error
Error: Cannot find module './en-us.js'
Source
src/layout/GlobalProvider/Locale.tsx (40:29) @ async eval
38 |
39 | // load default lang
> 40 | const dayJSLocale = await import(`dayjs/locale/${lang!.toLowerCase()}.js`);
| ^
41 |
42 | dayjs.locale(dayJSLocale.default);
43 | });
Upon closer examination, en-us.js
indeed appears to be missing:
ls ~/lobe-chat/node_modules/dayjs/locale
af.js bs.js en-tt.js gl.js kn.js ne.js sr-cyrl.js ug-cn.js
am.js ca.js en.js gom-latn.js ko.js nl-be.js sr.js uk.js
ar-dz.js cs.js eo.js gu.js ku.js nl.js ss.js ur.js
ar-iq.js cv.js es-do.js he.js ky.js nn.js sv-fi.js uz-latn.js
ar-kw.js cy.js es-mx.js hi.js lb.js oc-lnc.js sv.js uz.js
ar-ly.js da.js es-pr.js hr.js lo.js pa-in.js sw.js vi.js
ar-ma.js de-at.js es-us.js ht.js lt.js pl.js ta.js x-pseudo.js
ar-sa.js de-ch.js es.js hu.js lv.js pt-br.js te.js yo.js
ar-tn.js de.js et.js hy-am.js me.js pt.js tet.js zh-cn.js
ar.js dv.js eu.js id.js mi.js rn.js tg.js zh-hk.js
az.js el.js fa.js index.d.ts mk.js ro.js th.js zh-tw.js
be.js en-au.js fi.js is.js ml.js ru.js tk.js zh.js
bg.js en-ca.js fo.js it-ch.js mn.js rw.js tl-ph.js
bi.js en-gb.js fr-ca.js it.js mr.js sd.js tlh.js
bm.js en-ie.js fr-ch.js ja.js ms-my.js se.js tr.js
bn-bd.js en-il.js fr.js jv.js ms.js si.js types.d.ts
bn.js en-in.js fy.js ka.js mt.js sk.js tzl.js
bo.js en-nz.js ga.js kk.js my.js sl.js tzm-latn.js
br.js en-sg.js gd.js km.js nb.js sq.js tzm.js
The console doesn't log any errors and the application seem to be functional, if not for the pop up that appears each time I refresh the page.
The issue was observed both on Windows 11 (locally) and on Ubuntu 22.04.4 LTS. Node's version on Ubuntu was v20.16.0, and on Windows it was v18.17.1.
📷 Recurrence Steps
- Install node.js using the nvm method:
nvm install --lts
- Install pnpm:
curl -fsSL https://get.pnpm.io/install.sh | sh -
source ~/.bashrc
git clone https://github.com/lobehub/lobe-chat.git
cd lobe-chat
pnpm install
pnpm dev
- Open
http://127.0.0.1:3010
in Chrome and observe the error.
🚦 Expected Behavior
The error shouldn't appear and dayjs
should either have en-us.js
available or fallback to an available locale.
📝 Additional Information
No response