lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.46k stars 9.98k forks source link

[Bug] Error: Cannot find module './en-us.js' #3396

Closed ArakiSatoshi closed 2 months ago

ArakiSatoshi commented 3 months ago

📦 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

  1. Install node.js using the nvm method:
    nvm install --lts
  2. Install pnpm:
    curl -fsSL https://get.pnpm.io/install.sh | sh -
    source ~/.bashrc
  3. Build lobe-chat from master:
    git clone https://github.com/lobehub/lobe-chat.git
    cd lobe-chat
    pnpm install
    pnpm dev
  4. 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

lobehubbot commented 3 months ago

👀 @ArakiSatoshi

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

lobehubbot commented 2 months ago

✅ @ArakiSatoshi

This issue is closed, If you have any questions, you can comment and reply.\ 此问题已经关闭。如果您有任何问题,可以留言并回复。