Zaid-Ajaj / Feliz

A fresh retake of the React API in Fable and a collection of high-quality components to build React applications in F#, optimized for happiness
https://zaid-ajaj.github.io/Feliz/
MIT License
534 stars 78 forks source link

`npm start` does not serve, even with fresh template install #551

Closed kylegoetz closed 1 year ago

kylegoetz commented 1 year ago

Right off the Feliz website, I follow the instructions:

kylegoetz@MacBook-Pro test % dotnet new feliz -n AwesomeApp
The template "Feliz template" was created successfully.

kylegoetz@MacBook-Pro test % cd AwesomeApp 
kylegoetz@MacBook-Pro AwesomeApp % npm i

added 985 packages, and audited 986 packages in 6s

24 vulnerabilities (2 low, 2 moderate, 19 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
kylegoetz@MacBook-Pro AwesomeApp % npm start

> prestart
> dotnet tool restore

Tool 'fable' (version '3.7.17') was restored. Available commands: fable
Tool 'femto' (version '0.13.0') was restored. Available commands: femto

Restore was successful.

> start
> dotnet fable watch ./src -s --run webpack-dev-server

Fable: F# to JS compiler 3.7.17
Thanks to the contributor! @jmmk
Stand with Ukraine! https://standwithukraine.com.ua/

Parsing src/App.fsproj...
src> dotnet restore App.fsproj
  Determining projects to restore...
  Restored /Users/kylegoetz/Documents/workspace/test/AwesomeApp/src/App.fsproj (in 91 ms).
Project and references (3 source files) parsed in 1253ms

I visit http://localhost:8080 and there is no server running.

Is there something I'm missing?

kylegoetz commented 1 year ago

Oh, FWIW Node 15.14.0 and .Net 7.0.102. This is a brand new .Net install, having never done anything with .Net in my life.

MangelMaxime commented 1 year ago

Hello, there is currently an issue with Fable 3 and .NET7.

You need to fix .NET to version 6, instruction can be found in this issue:

https://github.com/fable-compiler/Fable/issues/3294

kylegoetz commented 1 year ago

How long should it take to serve? Because I added this file and did npm start and it's still hanging in the same place ("Project and references (3 source files) parsed in 76ms"). global.json is in the same directory as package.json.

And this time the beginning of the invocation contains

> prestart
> dotnet tool restore

Welcome to .NET 6.0!
---------------------
SDK Version: 6.0.405

So I know it's doing v6 now.

MangelMaxime commented 1 year ago

It is possible that you need to clean cached values.

If the gitignore file is set up correctly you can do gti clean -xdf or delete the obj and bin near the fsproj file.

kylegoetz commented 1 year ago

Thanks. dotnet fable clean did it and now I can serve and get the Hello World.

jmhimara commented 1 year ago

@MangelMaxime I'm actually having the same issue, with npm start hanging at the same place. However, dotnet fable clean does not seem to fix it.... It's a completely fresh install of the template, on windows.

kylegoetz commented 1 year ago

@jmhimara did you put the global.json file as referenced supra?

jmhimara commented 1 year ago

Yes, I have global.json set with net 6.0. And both 6 and 7 are installed on my machine. However, I was able to get it working after downgrading npm to version 15. Not sure how that makes sense, but here we are....

natalie-o-perret commented 1 year ago

@MangelMaxime Do you think that it would be worthwhile to add:

"engines": {
    "node": "15.14.0"
},

in the Feliz template package.json to force a 15.whatever node version?

At least that would make the error obvious (and maybe a note about how to leverage nvm)

Had to jump through quite many hoops / GitHub issues before being able to get started.

MangelMaxime commented 1 year ago

Do you have an error message or something that explains why you need node 15?

I am asking because Fable is not tied to a specific Node.js version and so if you have a problem it is most likely related to one of the JavaScript dependency