react-native-vector-icons
react-native-vector-icons copied to clipboard
error node_modules/react-native-vector-icons/lib/create-icon-set.js: #<WeakSet> could not be cloned.
error node_modules/react-native-vector-icons/lib/create-icon-set.js: #<WeakSet> could not be cloned.
Error: #<WeakSet> could not be cloned.
at Object.serialize (node:v8:260:7)
at _default (node_modules/@babel/core/lib/transformation/util/clone-deep.js:16:30)
at normalizeFile (node_modules/@babel/core/lib/transformation/normalize-file.js:52:36)
at normalizeFile.next (<anonymous>)
at run node_modules/@babel/core/lib/transformation/index.js:31:50)
at run.next (<anonymous>)
at /node_modules/@babel/core/lib/transform-ast.js:20:41
at Generator.next (<anonymous>)
at evaluateSync (/node_modules/gensync/index.js:251:28)
using "react-native": "0.64.0", and "react-native-vector-icons": "^8.1.0"
same here
any solution to this? I'm facing this error too
same issue any solution?
many libraries are throwing this issue
Error: #<WeakSet> could not be cloned.
Same here, I just upgraded rn from 0.61.5 to 0.64 and got this issue
has anyone found a solution to this problem?
Me too. I got this error. How can we solve this?
error: node_modules\react-native-vector-icons\lib\create-icon-set.js: #<WeakSet> could not be cloned.
I have tried with these versions and finally I can build it.
...
"react-native": "0.63.0",
"react-native-vector-icons": "^6.6.0",
...
But I don't think it is working properly. Too slow or sometimes stuck.
Hope this works fine.
Facing the same issue RNN ~> 0.64.0 vector-icons ~> ^8.1.0
I think the problem might be with @babel/core and @babel/runtime versions. I downgraded to the below versions and it worked for me;
"@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5",
@japhet247 , Do you mean with "react-native 0.64.0" and "react-native-vector-icons 8.1.0" ?
@Silver-IT , Yes
As @japhet247 said, downgrading @babel/core
and @babel/runtime
versions fixes the problem.
If you keep using the versions from the React Native template (https://github.com/facebook/react-native/blob/0.64-stable/template/package.json#L17), you will get higher versions of these libraries (see you package-lock.json):
"@babel/core": "7.14.0",
"@babel/runtime": "7.14.0",
To fix the problem, only allow patch version updates:
"@babel/core": "~7.12.9",
"@babel/runtime": "~7.12.5",
This will install:
"@babel/core": "7.12.17",
"@babel/runtime": "7.12.18",
Hope that helps.
Hi, i'm unable to reproduce this with a fresh 0.64 project, most likely this is a problem with your babel setup like @jmikulka mentions. Try setting it to
"@babel/core": "^7.14.0",
"@babel/runtime": "^7.14.0",
As @japhet247 said, downgrading
@babel/core
and@babel/runtime
versions fixes the problem.If you keep using the versions from the React Native template (https://github.com/facebook/react-native/blob/0.64-stable/template/package.json#L17), you will get higher versions of these libraries (see you package-lock.json):
"@babel/core": "7.14.0", "@babel/runtime": "7.14.0",
To fix the problem, only allow patch version updates:
"@babel/core": "~7.12.9", "@babel/runtime": "~7.12.5",
This will install:
"@babel/core": "7.12.17", "@babel/runtime": "7.12.18",
Hope that helps.
I got this working in react-native
0.64.1 and react-native-vector-icons
8.1.0
But in my case, i need to upgrade @babel/core and @babel/runtime to the lastest version:
yarn upgrade --dev @babel/core
and yarn upgrade --dev @babel/runtime
later, check package version to be sure that i installed with the lastest version
yarn list --pattern @babel/core
=> └─ @babel/[email protected]
yarn list --pattern @babel/runtime
=> └─ @babel/[email protected]
After that, i clean xcode builds then rebuild again and everything works like a charm!
"@babel/core": "7.12.17", "@babel/runtime": "7.12.18",
Thank you SO MUCH
For those of you dealing with hours of debugging @babel/core
being installed at multiple versions, here's the savior—add this to your package.json
"resolutions": {
"@babel/core": "7.12.*",
"@babel/runtime": "7.12.*"
},
Parameters of async methods cannot have default values. If the default value is taken, this error will be reported. The root cause is not clear for the time being. You can modify the source code through patch.
This will solve the problem
Same problem I lowered the versions of babel but same problem
@mjylfz I can't find the code of your screenshot in my node_modules ?
I don't think this is even related to this library, but I've been having the same issue with babel ever since trying to upgrade to RN 0.65.1
Any other work arounds?
Same issue with another library, downgrading metro doesn't seem to work. For RN 65 the minimum required versions are higher than the ones we are trying to resolve to...
I've tried babel upgrading but it didn't worked. All that bug occured after another lib update (which is not connected to vector-icons) and don't know why or how.
Like (and thanks to) @mjylfz said you should change the default value setting on async function on source code.
On <project-root>/node_modules/react-native-vector-icons/lib/create-icon-set.js
file; change all the async functions (which are loadFont
and getImageSource
) default parameter setting.
As like;
...
...
async function getImageSource(
name,
size,
color
) {
size = size || DEFAULT_ICON_SIZE,
color = size || DEFAULT_ICON_COLOR
...
...
async function loadFont(file) {
file = file || fontFile
...
...
What worked for us in the end was not related to babel.
we recreated yarn.lock
and Podfile.lock
and it all worked well after cleaning all node modules and caches... likely some old dependency hanging around.
If stuck, try deleting those files and recreatim them (cleaning the caches). I know many people do this regulary but we don't. So likely the problem will go away that way
For those of you dealing with hours of debugging
@babel/core
being installed at multiple versions, here's the savior—add this to your package.json"resolutions": { "@babel/core": "7.12.*", "@babel/runtime": "7.12.*" },
Unfortunately this doesn't seem to work with [email protected]
anymore:
Unknown option: .browserslistConfigFile.
And if I patch that out, I get:
Cannot find module '@babel/plugin-transform-react-jsx'
I feel like this is a rabbit hole I don't want to go down
What worked for me was the same. Delete the lock files and all your node modules. Re-install everything, and double check your lock file to ensure only one babel dependency is listed.
I second deleting the lock files, it also worked for me
Thanks, @cristianoccazinsp, and @raimonkh for your suggestion! There was actually an older version lying around which I wasn't aware of 🙌
FYI - Deleting the lock files worked for me as well
The resolutions
solution still worked for me, going from 0.64.0 to 0.65.1
@Vannevelj you were able to stay on the babel 7.12 versions but not see the Unknown option: .browserslistConfigFile.
error when running react-native bundle?