Zaid-Ajaj / SAFE-TodoList

The simplest Todo app showcasing a client-server application written entirely in F#
45 stars 8 forks source link

The build fails when running build.cmd #41

Open mrakgr opened 1 year ago

mrakgr commented 1 year ago

I just ran ./build.cmd from the PS terminal in VS Code. I also tried ./build.cmd RunDevMode, but that gave the same error. Right now I am just checking out the examples on the SAFE Stack site. Not just this one, I've noticed previous that whenever the package.json uses the old fable-compiler and fable-loader as its dev dependencies, the build fails.

Paket version 7.2.0+bb14ab674b2748070a624f394cd6796e11aaffa8
Restoring E:\Webdev\Fable\SAFE-TodoList\src\Client\Client.fsproj
Restoring E:\Webdev\Fable\SAFE-TodoList\src\Server\Server.fsproj
Starting full restore process.
Downloading FAKE 4.64.14 (Build)
Download of FAKE 4.64.14 (Build) done in 9 seconds. (10194 kbit/s, 11 MB)
Downloading Fable.Core 2.0.3 (Client)
Downloading Fable.Import.Browser 1.3 (Client)
Downloading Fable.SimpleJson 2.9 (Client)    
Downloading Fable.Elmish.Debugger 2.0.2 (Client)
Downloading Fable.React 4.1.3 (Client)
Download of Fable.Elmish.Debugger 2.0.2 (Client) done in 1 second. (192 kbit/s, 0 MB)
Downloading Fable.Elmish.HMR 3.0.2 (Client)
Download of Fable.SimpleJson 2.9 (Client) done in 1 second. (305 kbit/s, 0 MB)
Downloading FSharp.Core 4.6.1 (Client)
Download of Fable.Import.Browser 1.3 (Client) done in 2 seconds. (2998 kbit/s, 0 MB)
Downloading Fable.Import.HMR 0.1 (Client)
Download of Fable.React 4.1.3 (Client) done in 2 seconds. (1371 kbit/s, 0 MB)
Download of Fable.Core 2.0.3 (Client) done in 2 seconds. (509 kbit/s, 0 MB)
Downloading Fable.Remoting.Client 4.5.5 (Client)
Downloading Fable.Elmish 2.0.3 (Client)
Download of Fable.Elmish.HMR 3.0.2 (Client) done in 1 second. (191 kbit/s, 0 MB)
Downloading Fable.Elmish.React 2.1 (Client)
Download of Fable.Import.HMR 0.1 (Client) done in 1 second. (99 kbit/s, 0 MB)
Downloading Fable.Parsimmon 3.2 (Client)
Download of Fable.Remoting.Client 4.5.5 (Client) done in 1 second. (143 kbit/s, 0 MB)
Download of Fable.Elmish 2.0.3 (Client) done in 2 seconds. (115 kbit/s, 0 MB)
Downloading Fable.Elmish.Browser 2.1 (Client)
Download of Fable.Elmish.React 2.1 (Client) done in 2 seconds. (95 kbit/s, 0 MB)
Download of Fable.Parsimmon 3.2 (Client) done in 1 second. (159 kbit/s, 0 MB)
Download of FSharp.Core 4.6.1 (Client) done in 3 seconds. (5669 kbit/s, 2 MB)
Download of Fable.Elmish.Browser 2.1 (Client) done in 1 second. (187 kbit/s, 0 MB)
Downloading Thoth.Json 2.5 (Client)
Download of Thoth.Json 2.5 (Client) done in 895 milliseconds. (679 kbit/s, 0 MB)
Downloading LiteDB 4.1.4 (Server)
Downloading Suave 2.5 (Server)
Downloading Fable.Remoting.Json 2.2 (Server)
Downloading TypeShape 8.0.1 (Server)
Download of Fable.Remoting.Json 2.2 (Server) done in 869 milliseconds. (381 kbit/s, 0 MB)
Downloading Fable.Remoting.Server 4.4.1 (Server)
Download of TypeShape 8.0.1 (Server) done in 1 second. (2973 kbit/s, 0 MB)
Download of LiteDB 4.1.4 (Server) done in 1 second. (4502 kbit/s, 0 MB)
Downloading LiteDB.FSharp 2.15 (Server)
Download of Fable.Remoting.Server 4.4.1 (Server) done in 1 second. (771 kbit/s, 0 MB)
Downloading Fable.Remoting.Suave 3.7 (Server)
Download of Suave 2.5 (Server) done in 2 seconds. (4034 kbit/s, 1 MB)
Download of LiteDB.FSharp 2.15 (Server) done in 1 second. (1145 kbit/s, 0 MB)
Download of Fable.Remoting.Suave 3.7 (Server) done in 798 milliseconds. (364 kbit/s, 0 MB)
Total time taken: 26 seconds
Building project with version: LocalBuild
Shortened DependencyGraph for Target Build:
<== Build
   <== InstallClient
      <== Clean

The running order is:
  - Clean
  - InstallClient
  - Build
Running build with 1 worker
Starting Target: Clean 
Finished Target: Clean
Starting Target: InstallClient (==> Clean)
Node version:
CWD: E:\Webdev\Fable\SAFE-TodoList
cmd /C node --version
v16.16.0
Yarn version:
CWD: E:\Webdev\Fable\SAFE-TodoList
cmd /C yarn --version
1.22.19
CWD: E:\Webdev\Fable\SAFE-TodoList
cmd /C yarn install
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 46.64s.
Finished Target: InstallClient
Starting Target: Build (==> InstallClient)
CWD: E:\Webdev\Fable\SAFE-TodoList\src\Server
cmd /C dotnet build
MSBuild version 17.4.1+9a89d02ff for .NET
  Determining projects to restore...
C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security update
s in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\Webdev\Fable\SAFE-TodoList\src\Server\Server.fsproj]
C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security update
s in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\Webdev\Fable\SAFE-TodoList\src\Server\Server.fsproj]
  Restored E:\Webdev\Fable\SAFE-TodoList\src\Server\Server.fsproj (in 416 ms).
C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security update
s in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\Webdev\Fable\SAFE-TodoList\src\Server\Server.fsproj]
  Server -> E:\Webdev\Fable\SAFE-TodoList\src\Server\bin\Debug\netcoreapp2.0\Server.dll

Build succeeded.

C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security update 
s in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\Webdev\Fable\SAFE-TodoList\src\Server\Server.fsproj]
C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security update 
s in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\Webdev\Fable\SAFE-TodoList\src\Server\Server.fsproj]
C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security update 
s in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\Webdev\Fable\SAFE-TodoList\src\Server\Server.fsproj]
    3 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.05
CWD: E:\Webdev\Fable\SAFE-TodoList
cmd /C npm run build
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

> build
> webpack

Webpack mode: development
fable-compiler 2.1.11
E:\Webdev\Fable\SAFE-TodoList\src\Client> dotnet restore Client.fsproj
  Determining projects to restore...
  Restored E:\Webdev\Fable\SAFE-TodoList\src\Client\Client.fsproj (in 139 ms).

Parsing ./src/Client/Client.fsproj...
fable: Compiled src\Client\Client.fsproj
ERROR: File E:/Webdev/Fable/SAFE-TodoList/src/Client/App.fs doesn't belong to parsed project (E:/Webdev/Fable/SAFE-TodoList/src/Client/App.fs)
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1645.Invoke(String message)
   at Fable.Transforms.FSharp2Fable.Compiler.transformFile(ICompiler com, FSharpMap`2 implFiles) in /Users/alfonsogarciacaronunez/dev/fable_master/src/dotnet/Fable.Compiler/Transforms/FSharp2Fable.fs:line 1053
Hash: 6bf9b8cb1259348967e0
Version: webpack 4.29.3
Time: 9149ms
Built at: 02/13/2023 1:39:46 PM
 2 assets
Entrypoint main = bundle.js bundle.js.map
[./src/Client/App.fs] 388 bytes {0} [built] [failed] [1 error]
[./src/Client/Client.fsproj] 25 bytes {0} [built]

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/

ERROR in ./src/Client/App.fs
Module build failed (from ./node_modules/fable-loader/index.js):
Error: File E:/Webdev/Fable/SAFE-TodoList/src/Client/App.fs doesn't belong to parsed project (E:/Webdev/Fable/SAFE-TodoList/src/Client/App.fs)
    at E:\Webdev\Fable\SAFE-TodoList\node_modules\fable-loader\index.js:76:22
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
 @ ./src/Client/Client.fsproj 1:0-25 1:0-25
Running build failed.
Error:
System.Exception: 'E:\Webdev\Fable\SAFE-TodoList> cmd /C npm run build' task failed
   at FSI_0005.Build.run(String fileName, String args, String workingDir) in E:\Webdev\Fable\SAFE-TodoList\build.fsx:line 33
   at FSI_0005.Build.clo@50-3.Invoke(Unit unitVar0) in E:\Webdev\Fable\SAFE-TodoList\build.fsx:line 54
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 626

---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target          Duration
------          --------
Clean           00:00:00.0001625
InstallClient   00:00:47.4932773
Build           Failure
Total:          00:01:10.5981524
---------------------------------------------------------------------
Status:         Failure
---------------------------------------------------------------------
---------------------------------------------------------------------
  1) System.Exception: 'E:\Webdev\Fable\SAFE-TodoList> cmd /C npm run build' task failed
   at FSI_0005.Build.run(String fileName, String args, String workingDir) in E:\Webdev\Fable\SAFE-TodoList\build.fsx:line 33
   at FSI_0005.Build.clo@50-3.Invoke(Unit unitVar0) in E:\Webdev\Fable\SAFE-TodoList\build.fsx:line 54
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 626
---------------------------------------------------------------------
mrakgr commented 1 year ago

I've also tried tabula-rasa, but the build for that fails because I do not have python2 installed. That is what the error message says. I am just going through these all in turn. I'd open an issue on the relevant repo, but it has been archived.

I am not really expecting you to fix all of these, had I been the author, I am not sure I myself would have the will, but since I am at it I might as well post the results.

Zaid-Ajaj commented 1 year ago

Hi @mrakgr I don't know exactly why the build is failing. However, this project along with tabula-rasa are extremely out dated with respect to tooling. Right now. your best bet is to start a new SAFE stack application and only move the code over to that newer project. The code approach should be the same

Zaid-Ajaj commented 1 year ago

Even better, when you get the project working from a fresh SAFE template, consider opening a PR to replace this one 😄

mrakgr commented 1 year ago

Hmmm, maybe I could. At this point these projects are so old that I can assume the all builds would fail. I tried the Bookstore and it is failing. Ok, I'll change my strategy and get at least this project to work.

mrakgr commented 1 year ago

I've been having trouble figuring out how to make Webpack work, so I've switched over to Vite in my fork. I've finally managed to get it to run, and let me tell you, it wasn't easy! Though the dev server works, I can't test anything else, as I do not know how to host web apps yet.

Besides that, even with the regular SAFE Stack template, when I run the dev server and look in the console, there are uncaught websocket exceptions that I do not how to deal with. I could use some advice on that.

As much as I'd like to make a PR, until I can be sure all the install options work this is my limit. With my current knowledge, at most I can only get the examples where they would be runnable on a dev server.