I've been trying to use fable-import-fetch on my project and it doesn't compile due to the following error:
node_modules/fable-import-fetch/Fable.Helpers.Fetch.fs(79,2,79,14) : error FSHARP: The type 'KeyValueList' is not defined.
However, 'KeyValueList' is listed on the documentation
VS code also highlights 'KeyValueList' complaining that it doesn't exist.
What happened to KeyValueList on fable 0.7?
simply import Fetch
open Fable.Core
open Fable.Import.Fetch
open Fable.Helpers.Fetch
Error during compilation:
ERROR in ./FableInterop.fsproj
/home/jasf/Documents/precious-metals-app/client-side/node_modules/fable-import-fetch/Fable.Helpers.Fetch.fs(21,2,21,14) : error FSHARP: The type 'KeyValueList' is not defined.
@ multi (webpack)-dev-server/client?http://localhost:8080 ./FableInterop.fsproj
ERROR in ./FableInterop.fsproj
/home/jasf/Documents/precious-metals-app/client-side/node_modules/fable-import-fetch/Fable.Helpers.Fetch.fs(25,2,25,14) : error FSHARP: The type 'KeyValueList' is not defined.
@ multi (webpack)-dev-server/client?http://localhost:8080 ./FableInterop.fsproj
ERROR in ./FableInterop.fsproj
/home/jasf/Documents/precious-metals-app/client-side/node_modules/fable-import-fetch/Fable.Helpers.Fetch.fs(75,2,75,14) : error FSHARP: The type 'KeyValueList' is not defined.
@ multi (webpack)-dev-server/client?http://localhost:8080 ./FableInterop.fsproj
ERROR in ./FableInterop.fsproj
/home/jasf/Documents/precious-metals-app/client-side/node_modules/fable-import-fetch/Fable.Helpers.Fetch.fs(79,2,79,14) : error FSHARP: The type 'KeyValueList' is not defined.
@ multi (webpack)-dev-server/client?http://localhost:8080 ./FableInterop.fsproj
Hi @jzsimbiose! Sorry, we need to deprecate that library. Now the fetch API with some additional helpers is available in Fable.PowerPack. See https://github.com/fable-compiler/Fable/issues/951#issuecomment-303853152
I've added the following line to paket.dependencies:
nuget Fable.PowerPack 1.0.0-narumi-902
and run dotnet restore
and I get:
Paket version 5.0.0-rc005
paket.dependencies and paket.lock are out of sync in /home/jasf/Documents/brick-abode/precious-metals-app/client-side.
Please run 'paket install' or 'paket update' to recompute the paket.lock file.
Changes were detected for Main/Fable.PowerPack
- PackageNotFoundInLockFile
Performance:
- Disk IO: 10 seconds
- Runtime: 17 seconds
Restoring packages for /home/jasf/Documents/brick-abode/precious-metals-app/client-side/FableInterop.fsproj...
Restoring packages for /home/jasf/Documents/brick-abode/precious-metals-app/client-side/FableInterop.fsproj...
Lock file has not changed. Skipping lock file write. Path: /home/jasf/Documents/brick-abode/precious-metals-app/client-side/obj/project.assets.json
Restore completed in 7,53 sec for /home/jasf/Documents/brick-abode/precious-metals-app/client-side/FableInterop.fsproj.
Restore completed in 16,6 sec for /home/jasf/Documents/brick-abode/precious-metals-app/client-side/FableInterop.fsproj.
NuGet Config files used:
/home/jasf/.nuget/NuGet/NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
I don't have paket installed on my system (at least as a standalone command), so I imagine it must be embedded into dotnet pipeline somehow.
If I manually run with nuget:
cd packages
mono ~/Downloads/nuget.exe Install Fable.PowerPack -Version 1.0.0-narumi-902 -Pre
I get a bunch of directories created (first time I did it downloaded them to project root dir), including Fable.PowerPack.1.0.0-narumi-902.
What is the proper way of setting this additional dependency?
I want it to be included to when running dotnet restore.
@jzsimbiose Normally, you should have a folder .paket at the root directory of your project. And in this folder, you should see a paket.exe file.
Did you create your project using a template ?
Yes I did @MangelMaxime. I created the project with: dotnet new fable, and I learned now that that's where I got paket from (first time Fable and F# here, by the way).
I managed to get it installed.
Here are the steps:
added this line to paket.references (not sure if necessary):
Fable.PowerPack
added this line to paket.dependencies (I think this one is necessary, since there's a comment on the file "# Add here other Fable libraries like Fable.PowerPack"):
nuget Fable.PowerPack 1.0.0-narumi-902
update paket:
mono .paket/paket.exe update
restore:
dotnet restore
check Fable.PowerPack was created:
$ ls packages | grep Fable
Fable.Core
Fable.PowerPack
Can't you use nuget Fable.PowerPack into the paket.dependencies ? Because here you are manually pinning the version
I'll check this later and update my previous post.
As for PowerPack, you happen to have any snippet on how to run GET and POST requests with it?
You can try taking a look at the Test.fs file
You also got some helpers for POST request. See this lines
first time Fable and F# here, by the way
I think that's something that could be considered for the docs. I think it would be nice if the Fable documentation had some different "Getting started (for newbies)" paths. Here are some I can think of right now:
paket.dependencies, paket.lock and paket.references.fsproj file?babel-* packages in package.json?These pages don't need to be super detailed, a briefly introduction could be enough already. But they should offer some links for more detailed and, what's more important, up to date, information.
As Fable hit the v1 beta, I wished there was a "I'm a .NET person, never did any real JS and, WTF, why does dotnet restore update my packages?!", but that's another story 馃槃
Thanks for the comments @inosik, they're really helpful! Fable 1.1 _stablish_ is going to be released real soon so we can focus more on documentation, and as you say it'd be ver nice to have different Getting started sessions depending on people's background. Of course any help with this would also be really appreciated!
Closing this for now as the documentation has already been updated, as I need to focus on FableConf now it's difficult to make the docs more detailed for people with different backgrounds but I tried to give links so people can now about the tools used. The README of Fable.Template also contains some explanation about the project structure and why those specific files were generated (it's tricky to add this to the general docs because other projects could have different structures).