Giter Site home page Giter Site logo

Comments (27)

 avatar commented on June 11, 2024 1

@scorelocity try doing this:

  1. Update the BooksView.fs file. Switch open Giraffe.GiraffeViewEngine for open Giraffe.ViewEngine.
  2. Update the Books.Repository.fs. Delete the open FSharp.Control.Tasks.ContextInsensitive.
  3. Update the Books.Controller.fs. Delete the open FSharp.Control.Tasks.ContextInsensitive.

After those changes, try the dotnet run again.

from saturn.

precisemath avatar precisemath commented on June 11, 2024 1

I created this PR: #364 as a part of this discussion. It changes GiraffeViewEngine to Giraffe.ViewEngine.

from saturn.

mrakgr avatar mrakgr commented on June 11, 2024 1

I followed the stuff in here: https://saturnframework.org/tutorials/how-to-start.html

But dotnet fake build -t run doesn't work for me so I am running it with dotnet run --project ./src/Saturn-sample/.

from saturn.

mrakgr avatar mrakgr commented on June 11, 2024 1

Btw, dotnet new saturn -lang F# should be dotnet new Saturn -lang F#.

from saturn.

mrakgr avatar mrakgr commented on June 11, 2024 1

Wait, I get it.

PS E:\Webdev\Fable\SaturnSample> dotnet saturn migration
-------------------------------------------------------------------------------
Migrating from 0: Empty Schema to 202302071317: CreateBooks (Create Books)
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
202302071317: CreateBooks (Create Books) migrating
-------------------------------------------------------------------------------

CREATE TABLE Books(
      id TEXT NOT NULL,
      title TEXT NOT NULL,
      author TEXT NOT NULL
    )

-------------------------------------------------------------------------------
Done
-------------------------------------------------------------------------------


PS E:\Webdev\Fable\SaturnSample> 

I didn't think this would be a problem, but it seems the directory needs to be exactly SaturnSample. I skipped that step and had issues with the solution file previously, and now it seems the database. Sorry about this. Still, I wonder why the database migration needs to have a hardcoded directory like this?

from saturn.

 avatar commented on June 11, 2024

Are you able to run this?

dotnet --list-sdks

from saturn.

scorelocity avatar scorelocity commented on June 11, 2024

Yes:

6.0.301 [/usr/share/dotnet/sdk]

from saturn.

scorelocity avatar scorelocity commented on June 11, 2024

Seems that Fake is not being installed. It appears that fake-cli was removed from dotnet-tools.json in the Saturn template in this commit:

SaturnFramework/Saturn.Template@9e46b28

and therefore not being installed as part of

dotnet tool restore

Does it need to be installed some other way?

from saturn.

 avatar commented on June 11, 2024

I think it does not need to be installed. Previously it was used to facilitate the building of the project.

I thought that it would be possible to run this template by:

# after installing the template and instantiating a sample project
# ...
dotnet run --project ./src/SaturnSample/

But it's throwing a bunch of errors.

from saturn.

 avatar commented on June 11, 2024

Hum, those errors are related to the BooksViews, BooksRepository and BooksController. My guess is that after the upgrade that removed Fake (probably due to .NET incompatibilities), the feature of creating View/Repository/Controller automatically through the CLI started creating outdated files which does not compile.

❯ dotnet run --project ./src/SaturnSample/
    ~/SaturnSample/src/SaturnSample/Books/BooksViews.fs(4,14): error FS0039: The namespace 'GiraffeViewEngine' is not defined. [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksViews.fs(10,7): error FS0039: The value or constructor 'div' is not defined. Maybe you want one of the following:   dict   Edit [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksViews.fs(40,18): error FS0039: The value or constructor 'section' is not defined. Maybe you want one of the following:   Action [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksViews.fs(45,7): error FS0039: The value or constructor 'div' is not defined. Maybe you want one of the following:   dict   Edit [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksViews.fs(57,18): error FS0039: The value or constructor 'section' is not defined. Maybe you want one of the following:   Action [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksViews.fs(61,7): error FS0039: The value or constructor 'div' is not defined. Maybe you want one of the following:   dict   Edit [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksViews.fs(67,7): error FS0039: The value or constructor 'div' is not defined. Maybe you want one of the following:   dict   Edit [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksViews.fs(81,7): error FS0039: The value or constructor 'div' is not defined. Maybe you want one of the following:   dict   Edit [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksViews.fs(91,7): error FS0039: The value or constructor 'div' is not defined. Maybe you want one of the following:   dict   Edit [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksViews.fs(102,18): error FS0039: The value or constructor 'section' is not defined. Maybe you want one of the following:   Action [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksRepository.fs(6,27): error FS0039: The namespace 'ContextInsensitive' is not defined. [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]
    ~/SaturnSample/src/SaturnSample/Books/BooksController.fs(4,27): error FS0039: The namespace 'ContextInsensitive' is not defined. [~/SaturnSample/src/SaturnSample/SaturnSample.fsproj]

The build failed. Fix the build errors and run again.

from saturn.

scorelocity avatar scorelocity commented on June 11, 2024

Yes, I'm getting the same errors when using dotnet run.

from saturn.

scorelocity avatar scorelocity commented on June 11, 2024

Yes, that seemed to work. Since this workaround didn't match any docs or README, I wonder if this should be an issue in the Saturn.Template project (I opened it here because I did not know what the problem was). It's also not clear if Saturn is intentionally moving away from Fake.

Anyways, @vgajo , thank you for your help.

from saturn.

 avatar commented on June 11, 2024

I created a PR to fix the template in Saturn.Cli repository, so we don't need to manually delete and switch some instructions.

We need to work later in the docs.

Please keep this issue open, while we don't have a PR to fix it (you can create it if you want).

from saturn.

64J0 avatar 64J0 commented on June 11, 2024

I created this PR ^ to update the how-to-start guide. You can find more details reading its description.

from saturn.

mrakgr avatar mrakgr commented on June 11, 2024

I am having issues opening the template project as well. I got it to run, but am wondering why Ionide can't open the project to give me type inference. Right now I am trying to open it in Visual Studio, and I see that it is complaining that Saturn_sample.fsproj is not there. I am looking in the directory and see that it is named Saturn-sample.fsproj.

from saturn.

mrakgr avatar mrakgr commented on June 11, 2024

I've edited the solution file by hand to fix this. I wonder if there is a way to delete and regenerate the solution automatically?

from saturn.

mrakgr avatar mrakgr commented on June 11, 2024

The main page loads, but going to: http://localhost:8085/books

Gives the following error:

SQLite Error 1: 'no such table: Books'.
Saturn-sample
at [email protected]() in E:\Webdev\Fable\Saturn-sample\src\Saturn-sample\Books\BooksController.fs:line 17 at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at Giraffe.Core.continuation@1-5(HttpContext ctx, FSharpList`1 tail, FSharpOption`1 _arg1) at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at [email protected](Unit unitVar) at Ply.TplPrimitives.tryWith[u](FSharpFunc`2 continuation, FSharpFunc`2 catch) --- End of stack trace from previous location --- at [email protected](Exception _arg2) at Ply.TplPrimitives.tryWith[u](FSharpFunc`2 continuation, FSharpFunc`2 catch) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at Giraffe.Core.continuation@1-5(HttpContext ctx, FSharpList`1 tail, FSharpOption`1 _arg1) at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at Saturn.PipelineHelpers.continuation@1-4(FSharpFunc`2 nxt, HttpContext ctx, Unit _arg1) at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at [email protected](Unit unitVar) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context) at [email protected](Unit unitVar) at Ply.TplPrimitives.tryWith[u](FSharpFunc`2 continuation, FSharpFunc`2 catch)

I am not familiar with databases so I have no idea what to do here.

from saturn.

64J0 avatar 64J0 commented on June 11, 2024

@mrakgr What command did you use to create the project locally?

from saturn.

64J0 avatar 64J0 commented on June 11, 2024

Got it, I think the instructions there are a bit wrong. Maybe those instructions work well:

I'm going to test it in my local environment soon.

from saturn.

mrakgr avatar mrakgr commented on June 11, 2024

Do I need to install anything special for SQLite perhaps?

from saturn.

64J0 avatar 64J0 commented on June 11, 2024

What is the output of the dotnet saturn migration?

from saturn.

mrakgr avatar mrakgr commented on June 11, 2024
PS E:\Webdev\Fable\Saturn-sample> dotnet saturn migration

PS E:\Webdev\Fable\Saturn-sample> 

Nothing as far I can see. I forgot whether something has happened the first time around? I'll try a fresh template.

from saturn.

mrakgr avatar mrakgr commented on June 11, 2024

I tried it, and the output of the migration is the same as above.

from saturn.

64J0 avatar 64J0 commented on June 11, 2024

Hum, weird, it was supposed to create the database with this command. There is something wrong with it then. This CLI command is related to this project AFAIK: https://github.com/SaturnFramework/Saturn.Cli.

from saturn.

64J0 avatar 64J0 commented on June 11, 2024

It's pretty weird, for sure. And it's also curious that it does not throw any error when you run the command outside the expected directory.

from saturn.

mrakgr avatar mrakgr commented on June 11, 2024
[<EntryPoint>]
let main argv =
    let assembly = Assembly.GetExecutingAssembly()
    use db = new SqliteConnection "DataSource=src/Saturn-sample/database.sqlite"

I figured out how to make the database migration work on the project inside the Saturn-sample directory. I changed the use db = new SqliteConnection "DataSource=src/Saturn_sample/database.sqlite" to what you see above and the migration worked. I had to do similar kinds of fixes in the .sln file previously.

I review, though I apologized for failing to follow the instructions exactly, it is clearly that the template is broken. Maybe it is converting the - to _ for some reason.

from saturn.

rusanov-vladimir avatar rusanov-vladimir commented on June 11, 2024

I believe you were hitting this bug. And there is a PR attempting to fix the template.

from saturn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.