Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nextjs15:hexoid is not a function #681

Open
yoniu opened this issue Nov 4, 2024 · 0 comments
Open

nextjs15:hexoid is not a function #681

yoniu opened this issue Nov 4, 2024 · 0 comments

Comments

@yoniu
Copy link

yoniu commented Nov 4, 2024

运行环境:node20、next15、react18

问题描述:

我在应用里加了个 leancloud 用户登录功能,打包的时候出现 hexoid is not a function 的报错。

另外还提示缺少utf-8-validatebufferutil 两个依赖

代码:

  const handleLogin = () => {
    setLoading(true)
    User.logIn(username, password).then(
      (user) => {
        // 登录成功
        messageApi.success("欢迎回来," + user.getUsername())
        setVisible(false)
        props.onLogin()
      },
      (error) => {
        // 登录失败
        messageApi.error(error.message)
      }
    ).finally(() => {
      setLoading(false)
    })
  }

报错:

 ⨯ node_modules/.pnpm/[email protected]/node_modules/formidable/src/Formidable.js (15:1) @ eval
 ⨯ TypeError: hexoid is not a function
    at __webpack_require__ (/workspace/homepage/dist/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/workspace/homepage/dist/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/workspace/homepage/dist/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/workspace/homepage/dist/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/workspace/homepage/dist/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/workspace/homepage/dist/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/workspace/homepage/dist/server/webpack-runtime.js:33:43)
    at eval (./src/hooks/leancloud.ts:5:75)
    at (ssr)/./src/hooks/leancloud.ts (/workspace/homepage/dist/server/app/moment/page.js:463:1)
    at __webpack_require__ (/workspace/homepage/dist/server/webpack-runtime.js:33:43)
    at eval (./src/app/moment/page.tsx:9:78)
    at (ssr)/./src/app/moment/page.tsx (/workspace/homepage/dist/server/app/moment/page.js:419:1)
    at Object.__webpack_require__ [as require] (/workspace/homepage/dist/server/webpack-runtime.js:33:43)
    at JSON.parse (<anonymous>)
digest: "3492828021"
  13 | const qs = require('qs');
  14 |
> 15 | const toHexoId = hexoid(25);
     | ^
  16 | const DEFAULT_OPTIONS = {
  17 |   maxFields: 1000,
  18 |   maxFieldsSize: 20 * 1024 * 1024,
 GET /moment 500 in 63ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant