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

TypeError: Cannot read properties of undefined (reading 'evaluate') #2596

Closed
feraskh0378 opened this issue Jun 13, 2022 · 12 comments
Closed

Comments

@feraskh0378
Copy link

Hi,

I am using mathjs with electron - react app.
I got the error in the Title when calling "evaluate", can you please help? what is the issue?

I am doing the following:

import { evaluate } from 'mathjs'

evaluate(arg[1],scope)

my arg and scope:

image

Thanks,

@josdejong
Copy link
Owner

How can we reproduce your issue? Does it happen only in an Electron environment, or also in say the developer console of the website https://mathjs.org?

@feraskh0378
Copy link
Author

feraskh0378 commented Jun 13, 2022

it reproduced only with electron.
when I run my code with chrome it works with no issues.

I am building a windows app using https://electron-react-boilerplate.js.org/ , typescript and react , and I am using mathjs from the renderer process as above.

@josdejong
Copy link
Owner

So:

How can we reproduce your issue?

@gwhitney
Copy link
Collaborator

Are you sure you aren't just having a difficulty importing mathjs? Are you sure you have the package installed correctly for it to be found in the electron environment? I ask because at first glance, it seems as though the error is saying that 'evaluate' is undefined...

@feraskh0378
Copy link
Author

I am installing mathjs as 👍

  1. npm install mathjs

using it as 👍

import {evaluate} from "mathjs"

expression = evalaute(arg[1], scope)

what wrong I am doing?

@josdejong
Copy link
Owner

Hard to tell without being able to reproduce the issue.

What you could try is import the bundle, like import 'mathjs/lib/browser/math.js'.

@pramod-bls

This comment was marked as off-topic.

@gwhitney

This comment was marked as off-topic.

@pramod-bls

This comment was marked as off-topic.

@gwhitney

This comment was marked as off-topic.

@pramod-bls

This comment was marked as off-topic.

@josdejong
Copy link
Owner

I'll close this issue now due to lack of information on now to reproduce. Please re-open if there is more information.

One issue that has a different cause is discussed separately in #2990.

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

4 participants