我如何修复:details.family.tolowercase不是一个函数

发布于 2025-02-07 04:00:47 字数 1009 浏览 1 评论 0 原文

我正在尝试运行测试库测试,但会出现以下错误。直到我最近更新NPM和节点为止。

 npm test

> [email protected] test
> node index.js test

TypeError: details.family.toLowerCase is not a function
    at C:\mac\github\e2e-tests\node_modules\ip\lib\ip.js:385:39
    at Array.filter (<anonymous>)
    at C:\mac\github\e2e-tests\node_modules\ip\lib\ip.js:384:37
    at Array.map (<anonymous>)
    at ip.address (C:\mac\e2e-tests\node_modules\ip\lib\ip.js:379:37)
    at Proxy.getIPAddress (C:\mac\e2e-tests\node_modules\endpoint-utils\index.js:109:15)
    at getValidHostname (C:\mac\e2e-tests\node_modules\testcafe\lib\index.js:26:34)
    at createTestCafe (C:\mac\e2e-tests\node_modules\testcafe\lib\index.js:71:9)
    at async run (C:\mac\e2e-tests\test-runner.js:40:20)
    at async testRunner (C:\mac\e2e-tests\test-runner.js:117:10)
    at async start (C:\mac\e2e-tests\index.js:9:22)

I am trying to run a Testcafe test but get the following Error. This used to work until I recently updated npm and Node.

 npm test

> [email protected] test
> node index.js test

TypeError: details.family.toLowerCase is not a function
    at C:\mac\github\e2e-tests\node_modules\ip\lib\ip.js:385:39
    at Array.filter (<anonymous>)
    at C:\mac\github\e2e-tests\node_modules\ip\lib\ip.js:384:37
    at Array.map (<anonymous>)
    at ip.address (C:\mac\e2e-tests\node_modules\ip\lib\ip.js:379:37)
    at Proxy.getIPAddress (C:\mac\e2e-tests\node_modules\endpoint-utils\index.js:109:15)
    at getValidHostname (C:\mac\e2e-tests\node_modules\testcafe\lib\index.js:26:34)
    at createTestCafe (C:\mac\e2e-tests\node_modules\testcafe\lib\index.js:71:9)
    at async run (C:\mac\e2e-tests\test-runner.js:40:20)
    at async testRunner (C:\mac\e2e-tests\test-runner.js:117:10)
    at async start (C:\mac\e2e-tests\index.js:9:22)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枉心 2025-02-14 04:00:48

这似乎是 bug 与节点的版本18,与 ip软件包(用于许多流行的库中Storybookjs/storybook/desission/18010“ rel =“ nofollow noreferrer”> Storybook 和下一个UI )。

您可以尝试过度骑行 IP 的版本

{
  "overrides": {
    "ip": "1.1.8"
  }
}

至少在我的情况下 - 我遇到采用这种方法。目前唯一的“修复程序”是降级使用Node/npm的长期支持(LTS)版本(当前 16.15.1 )而不是17/18。我强烈推荐 nvm ,它会让您只需 nvm instal lts lts lts

This appears to be a bug with version 18 of node, interacting with the ip package (used in lots of popular libraries like Storybook and next ui).

You can try over-riding to use the latest version of ip:

{
  "overrides": {
    "ip": "1.1.8"
  }
}

But - in my case at least - I ran into further issues with that approach. The only "fix" for now is to downgrade to use the long-term support (LTS) version of node/npm (currently 16.15.1) rather than 17/18. I highly recommend nvm, which will let you just do nvm install lts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文