Closed 2018Cool closed 3 years ago
Going back to 8.1.0 fixed it for us.
Thanks for reporting. How can I reproduce this issue?
Going back to 8.1.0 modify package.json: "mathjs": "8.1.0"
@lssdo12 how can I reproduce this issue?
Closing as "cannot reproduce".
Same error in 9.4.4, has to downgrade to 8.1.0. Only reproduciable with npm run build, not in live mode
app.43ad66f7631ca0a39db3.js:89 Uncaught SyntaxError: In "GeV^-2", "^" must be followed by a floating-point number
at Function.S.parse (app.43ad66f7631ca0a39db3.js:89)
at new S (app.43ad66f7631ca0a39db3.js:89)
at app.43ad66f7631ca0a39db3.js:89
at a (app.43ad66f7631ca0a39db3.js:89)
at Object.NHnr (app.43ad66f7631ca0a39db3.js:89)
at t (manifest.eeb2c031c0c552bd70ec.js:1)
at window.webpackJsonp (manifest.eeb2c031c0c552bd70ec.js:1)
at app.43ad66f7631ca0a39db3.js:1
@lssdo12 how can I reproduce this issue?
import mathjs can produce that
@josdejong Please reopen and investigate this issue. The stack above should be helpful to you
Please provide specific steps so that we can reproduce the error. So far you have failed to provide any useful information.
The code in OP works without a problem.
The only thing I did in VUE is
import { evaluate } from 'mathjs'
...
methods: xxx() {
return evaluate(xxxxx)
}
Hmm, looks like a babel or math expression evaluator version issue
I've created a new Vue project, imported evaluate
and called it. I've tried running the app both in developer mode and in release mode. Everything works as expected for me, no error or anything. Here's my repo: https://github.com/m93a/mathjs-vue-test
Could you try to create a minimal repo that reproduces this issue?
2022-06-29 still has the same problem
@mydansun thanks for reporting. How can we reproduce this issue exactly? So far we have no clue how to reproduce it.
hello, i find the same problem at 2022-08-27,can you provide solutions for this problem?thank u.
here is package.json of my vue project.
i had use mathjs for 8.1.0
, but it has no effect.
here is my util function that use mathjs
import { create, all } from 'mathjs'
const config = {
number: 'BigNumber',
precision: 20
}
const math = create(all, config);
export default {
//开方
numberSqrt: function (arg1) {
return math.sqrt(arg1)
},
//除
numberExcept: function (arg1, arg2) {
return arg2 == 0 ? 0 : math.divide(arg1, arg2)
},
//乘
numberRide: function (arg1, arg2) {
return math.multiply(arg1, arg2);
},
//加
numberAdd: function (arg1, arg2) {
return math.add(arg1, arg2);
},
//减
numberSub: function (arg1, arg2) {
return math.subtract(arg1, arg2);
}
}
when i use this util on dev enviroment,it's right;but if build for production enviroment,it's error.
Is this also an issue in the latest version of mathjs, v11.1.0
? If so, can you provide a minimal way to reproduce the issue?
have the same promble @11.10.0,
Thanks for reporting @lokialone . How can I reproduce this issue?
My guess is that you're using a unicode dash character that looks like the minus symbol -
.
Getting the same issue with 12.3.1 Using VueJs, Browser: Firefox
Works fine with no errors if I run my project through 'npm run dev' but when I run my project through 'npm run build' I get the error.
Here's how the code is being used:
import * as math from 'mathjs';
all we're using is the math.evaluate function. Works fine in dev.
Update: Downgraded the version to 8.1.0 as others suggested and it seems to resolve the issue.
might want to look into the version differences there.
Tried to replicate by:
Importing mathjs as:
import {create, all} from 'mathjs'
const math = create(all)
Running
math.evaluate("GeV^-2")
No issues either in npm run dev
or npm run build
Also tried importing mathjs as stated (I think it's not recommended):
import * as math from 'mathjs'
Still no issues either in npm run dev
or npm run build
@Tishinator do you have more information that could be useful to replicate this issue?
Also tested mathjs 12.3.1 still with no issues in dev or build with either method of importing mathjs.
"dependencies": {
"@ag-grid-community/all-modules": "^24.0.0",
"@ag-grid-community/core": "^24.0.0",
"@ag-grid-community/vue": "^24.0.0",
"@fortawesome/fontawesome": "^1.1.8",
"@fortawesome/fontawesome-free": "^5.12.0",
"@fortawesome/fontawesome-free-regular": "^5.0.13",
"@fortawesome/fontawesome-svg-core": "^1.2.26",
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-regular-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/vue-fontawesome": "^2.0.8",
"bootstrap": "^4.6.2",
"bootstrap-vue": "^2.22.0",
"fancy-log": "^1.3.3",
"jquery": "^3.6.1",
"lodash": "^4.17.21",
"mathjs": "^12.3.1",
"moment": "^2.29.4",
"router": "^1.3.7",
"vue": "^2.5.2",
"vue-bootstrap-typeahead": "^0.2.6",
"vue-class-component": "^7.2.6",
"vue-flatpickr-component": "^7.0.3",
"vue-fontawesome": "0.0.2",
"vue-form-wizard": "^0.8.4",
"vue-js-modal": "^1.3.35",
"vue-plotly": "^1.1.0",
"vue-property-decorator": "^8.5.1",
"vue-resource": "^1.5.3",
"vue-router": "^3.6.5",
"vuedraggable": "^2.23.2",
"vuejs-dialog": "^1.4.1",
"vuex": "^3.1.2"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1",
"copyfiles": "^2.4.1",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.7.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.11.5",
"webpack-merge": "^4.1.0"
},
Here's the extremely simplified version of what im working with: (ive tested with this code and got the same results)
// yards to inches
let value = 3
let equation = "value * 1296.0";
const scope = {
value : value
}
this.thisNum = math.evaluate(equation, scope)
Works on 8.1.0, Works on dev, Fails on live (build)
Tried to replicate by:
Running:
import { create, all } from 'mathjs'
const math = create(all)
let value = 3
let equation = "value * 1296.0";
const scope = {
value: value
}
math.evaluate(equation, scope)
No issues found in build
or dev
.
Also tried
import * as math from 'mathjs'
No issues found in build
or dev
.
Also tried running vue 2.7.7 with both methods of importing mathjs in build
or dev
. The issue was still not present.
I see you are using vue 2.5.2, it's no longer supported. Could you try to use the current version of vue just to see if it solves the issue?
Could you try importing ?
import { create, all } from 'mathjs'
const math = create(all)
@Tishinator is it possible to share a (minimal) git repo that demonstrates the issue? Since we've trouble replicating the issue on our side.
unfortunately for work reasons i cannot. but I will try and build a new project from home when i get the chance on a smaller scale.
Version: 8.1.1 Code: import { fraction, multiply, format } from 'mathjs' const transfer_amount= +format(multiply(fraction(this.acceptForm.transferAmount), fraction(PAYMENT_CONVERSION)), { fraction: 'decimal' })