Closed fourglobe302500 closed 2 years ago
Hello @fourglobe302500,
Which version of Fable.React are you using? Are you using NPM? PNPM? Yarn?
Can you please provide a reproduction directory?
Ok I just updated yarn and the problem changed to this
Unhandled exception. System.Exception: Error at: `$`
Expecting an object with a field named `data` but instead got:
{
"value": "react@npm:18.1.0",
"children": {
"Version": "18.1.0",
"Dependencies": [
{
"descriptor": "loose-envify@npm:^1.1.0",
"locator": "loose-envify@npm:1.4.0"
}
]
}
}
at Thoth.Json.Net.Decode.unsafeFromString[T](FSharpFunc`2 decoder, String value)
at Program.getPackageVersions(NodeManager nodeManager, NpmDependency pkg) in /Users/zaid/projects/Femto/src/Program.fs:line 217
at Program.libraries@1529-1.Invoke(NpmDependency pkg) in /Users/zaid/projects/Femto/src/Program.fs:line 1530
at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in D:\a\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 246
at Microsoft.FSharp.Collections.ListModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 list) in D:\a\_work\1\s\src\fsharp\FSharp.Core\list.fs:line 74
at Program.libraries@1526.Invoke(LibraryWithNpmDeps library) in /Users/zaid/projects/Femto/src/Program.fs:line 1537
at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in D:\a\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 244
at Program.runner(FemtoArgs args) in /Users/zaid/projects/Femto/src/Program.fs:line 1524
at Program.main(String[] argv) in /Users/zaid/projects/Femto/src/Program.fs:line 1664
It seems like yarn changed its format and Femto cannot parse it.
Hello @fourglobe302500,
someone reported a similar issue to your first problem. Here is my answer with a solution to it.
Note it doesn't explain the error you have in your second message. Do you remember which version of yarn you used?
Because you don't have a license field in your
package.json
yarn generates a strange response when runningyarn yarn info react versions --json
.It returns:
{"type":"warning","data":"package.json: No license field"} {"type":"inspect","data":["0.0.0-375616788","0.0.0-00d4f95c2","0.0.0-0203b6567","0.0.0-0935a1db3","0.0.0-0c756fb-697f004","0.0.0-0c756fb-f7f79fd","0.0.0-0cf9fc10b","0.0.0-0e4135e8c","0.0.0-0eea57724","0.0.0-1022ee0ec","0.0.0-10cc40018","0.0.0-11565a207","0.0.0-11b07597e","0.0.0-1214b302e","0.0.0-12adaffef","0.0.0-132b72d7b","0.0.0-172e...}
So form now you need to add a license field to your
package.json
.If your project is private you can set it to
"license": "UNLICENSED"
NPM docs.They also recommend setting
"private": true
as an extra security.
@MangelMaxime the yarn version is 3.2.1 the latest at the time
at the current time this issue remains since my package.json does have a license
@fourglobe302500
Yes, the issue in your case now is that the JSON format is not supported.
Femto was written for yarn 1, so it needs to be updated to support yarn 3 format too.
This is a matter of adapting the decoder here:
https://github.com/Zaid-Ajaj/Femto/blob/f1dd05845ca07dbae8b9df58995a1fb4fa18d940/src/Program.fs#L216
Something like that
let yarn1Decoder =Decode.field "data" (Decode.list Decode.string
let yarn3Decoder = // todo
let yarnDecoder =
Decode.oneOf [ yarn1Decoder; yarn3Decoder ]
let versions = Decode.unsafeFromString yarnDecoder res.Result.Output
Fixes as of Femto v0.14.0 🚀
I was trying to use femto on my fable app but it keeps on emiting this err
Failed to retrieve information about react required by Fable.React
What can I do?