-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Error on Fraction.js dependency #3022
Comments
Same here. |
There is probably something breaking introduced in the latest version of Fraction.js, https://www.npmjs.com/package/fraction.js?activeTab=versions To work around it you can probably explicitly install |
not work too , |
Can you try v4.2.0? That is where mathjs is last tested with. @infusion can it be that version 4.3.0 or 4.3.1 contain breaking changes? (in that case I would have expected a v5.0.0 release) |
I downgraded the mathjs version which worked for me. |
Hi, v4.3.0 was not supposed to have breaking changes. I'm looking into what the problem is, I changed the import/require behavior only slightly and tested it. But I somehow missed something |
I'm not yet able to reproduce an issue with |
Me neither, just installed math.js freshly here on my machine and everything seems to work |
Which version? |
i tried with all verisons: |
The change occurred in 4.3.0, I then had to fix a minor thing that resulted in 4.3.1. Anyway, what is your environment? What is your node version? I downgraded even to node 16 and it works just fine for me. |
It may help to throw away your |
I reverted the change. Hope that helps with 4.3.2 |
I have to dig a little deeper into what's going on here. But the package-lock could definitely be a problem! |
We were using 6.2.5 previously. So went back to it from v9... I tried downgrading to 7.0.0 and 8.0.0 but didnt work in both. |
is it now working again? |
"mathjs": "^9.4.4", Node version: 18.16.0 Deleted node_modules and yarn.lock and did install again. Still getting the error. Uncaught TypeError: Cannot set properties of undefined (setting 'type') |
Even with fraction 4.2.0? This version is quite dated and had no problems. I introduced this problem probably yesterday with my ESM module change. |
However when I bump mathjs version to the latest one. I get the following error. Fraction.js:9 Uncaught TypeError: Object.defineProperty called on non-object |
even with a fresh install? |
Yes. deleted node_modules, yarn.lock then installed. |
please lock fraction.js version 4.2.0 |
Struggle with the same problem i'm using node v 16.3 I have saved an old node_modules folder when i use this folder it runs good looked the versions i used there:
But when I change those in my package.json and remove package-lock.json, node_modules, and removed npm cache --force Then run npm install, and getting the same error:
|
I also reverted the changes in package.json. 4.3.3 is now the same as 4.2.0. Could anyone please check who has the same problem? |
Thanks Robert. I'm just publishing a new version of mathjs that locks I still have to figure out how to reproduce this issue in the first place. Seems related to |
Could we run the test without fixing the version please? Otherwise we will gain no info on how to solve this issue in the long run. |
Ok we can wait for a bit more, but I prefer not to wait for too long (possibly exposing more and more people to the problem). Even when the workaround is published we can still ask someone to test with |
Definitely, but as I said, 4.3.3 should be the same as 4.2.0. So hopefully it is fixed anyway for those people. Do you think it's a webpack problem? BTW Sorry for introducing this issue. |
Sorry my bad.. try it again... |
@Nagrom33 thanks for testing, please let us know if |
I haven't managed to reproduce the problem myself, but the error reports all mention Webpack so that is probably related or at least a way to reproduce the issue. To figure out what is wrong and fix it for real we will need to get some Webpack setup that reproduces the issue with |
Tried package.json:
Checked my node_modules folder "/node_modules/fraction.js/package.json" it said
But getting the same error:
|
So webpack has a problem with the .cjs filename then? |
@Nagrom33 thanks that is useful info. What version of Webpack are you using? Would it be possible for you to put together an empty webpack project with mathjs and fraction.js that reproduces the issue so we can do debugging on it? |
I renamed the cjs file to an ordinary js file again in 4.3.4 |
Yeah maybe that's it. Maybe related to this open issue: facebook/create-react-app#12700 |
I used react create app: "react-scripts": "^5.0.1" |
@infusion I managed to reproduce the issue in a plain The issue is indeed fixed with |
Thanks @josdejong ! This works for me!
Maybe to many steps and not all needed but, the problem is solved!! |
I've now published |
The problem with the renaming I see is this: As soon as you give the package a |
Ah ok. That sort of makes sense. But I guess the ESM and CommonJS versions cannot be the same, since ESM needs to use
I don't blame you at all. The JavaScript ecosystem is just extremely complex for library developers. Having to deal with various ways that you can configure package.json, dealing with CommonJS, ESM, TypeScript, different browsers, different versions of node.js, a lot of different bundlers like Vite, Rollup, Webpack, various CDN's, and things like the deprecated and outdated but widely used |
You don't need to use |
O I didn't know that. Good to know. |
Basically, what you have to do to supoort both, is exporting like this:
|
I have indeed seen that construct before. It feels a bit hacky but if it works it works :). Thanks for sharing. @infusion shall I close this issue? I think the cause is clear and the issue is fixed in the latest version of fraction.js. |
I was tinkering with your test repo. The problem is indeed this hacky solution. It seems webpack scans for an Yes I think we can close this issue. |
error on start:
Uncaught TypeError: Cannot set properties of undefined (setting 'type')
at push../node_modules/mathjs/lib/esm/type/fraction/Fraction.js.Object.isClass (Fraction.js:9:1)
at assertAndCreate (factory.js:35:1)
at ./node_modules/mathjs/lib/esm/entry/pureFunctionsAny.generated.js (pureFunctionsAny.generated.js:62:1)
The text was updated successfully, but these errors were encountered: