You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在NestJS中使用mathjs的evaluate方法时遭遇TypeError报错求助

在NestJS中使用mathjs的evaluate方法时遭遇TypeError报错求助

嘿各位开发者朋友!我最近在NestJS项目里尝试用mathjs的evaluate方法,结果碰到了个头疼的TypeError错误,折腾了好几种方案都没解决,来这里求助大家!

先把报错信息贴出来:

TypeError: Cannot read properties of undefined (reading 'prototype')
  at isMatrix (D:\AI\Projects\calc-api\node_modules\mathjs\lib\cjs\utils\is.js:103:29)
  at Array.testArgs (D:\AI\Projects\...

我已经试过下面这些办法,可惜都没见效:

  • 降级mathjs的版本,问题依然存在
  • 使用动态导入的方式引入mathjs,还是触发同样的错误
  • 尝试用工厂模式创建mathjs实例,依旧没解决问题

有没有朋友碰到过类似的情况?或者知道这个问题的排查方向,麻烦给我点建议,感谢啦!

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 13:33:10