running simple mathjs example: “Uncaught TypeError: Cannot convert a Symbol value to a string“

369 Views Asked by At

I’m very new to node.js, and am just trying to learn the basics. I’m using the play.js IDE on my iPad and want to try some simple math-related javascript. I have successfully used jStat functions within the IDE, so I know that I can get it to work.

I’d like to use mathjs, so I’ve resolved the dependency in my test project, and my package.json now looks like this:

{
  "name": "test",
  "version": "1.0.0",
  "dependencies": {
    "jstat": "^1.9.3",
    "mathjs": "^7.2.0"
  }
}

The files all appear to be installed under the node_modules directory.

In my index.js, I just have the following example code straight from the mathjs help:

const { sqrt } = require('mathjs')

However, when I run this, I get the following error:

Uncaught TypeError: Cannot convert a Symbol value to a string
    at Array.join (<anonymous>)
    at Array.toString (<anonymous>)
    at Array.join (<anonymous>)
    at Array.toString (<anonymous>)
    at Array.join (<anonymous>)
    at Array.toString (<anonymous>)
    at mixkey (/private/var/mobile/Containers/Data/Application/8FF30C6F-8C40-4A4C-BA59-869F18430F8D/Documents/apps/TEST3FB8CAB9-FC43-4D65-9554-11E37599A1BB/src/node_modules/seed-random/index.js:135:25)
    at module.exports (/private/var/mobile/Containers/Data/Application/8FF30C6F-8C40-4A4C-BA59-869F18430F8D/Documents/apps/TEST3FB8CAB9-FC43-4D65-9554-11E37599A1BB/src/node_modules/seed-random/index.js:35:19)
    at /private/var/mobile/Containers/Data/Application/8FF30C6F-8C40-4A4C-BA59-869F18430F8D/Documents/apps/TEST3FB8CAB9-FC43-4D65-9554-11E37599A1BB/src/node_modules/mathjs/lib/function/probability/util/seededRNG.js:18:65

If it helps, that line in lib/function/probability/util/seededRNG.js looks like this:

var singletonRandom = /* #__PURE__ */(0, _seedRandom["default"])();

Am I doing something obviously wrong? Is there something I need to read to understand why this won’t run, or is this an issue with mathjs?

0

There are 0 best solutions below