ryan-haskell / elm-spa-realworld

The RealWorld example app built with elm-spa!
https://realworld.elm-spa.dev
MIT License
57 stars 9 forks source link

package.json missed #4

Open johnwangwjq opened 3 years ago

johnwangwjq commented 3 years ago

Hi @ryannhg ,

How to run the app? I started it by npm start but failed with missing package.json. Sorry I'm new to npm and elm.

I've tried a package.json created by the elm-spa init command, but npm start gives a lot of error like the following:

Compiling ...-- MODULE NOT FOUND ---------------------------------- src\Components\Navbar.elm

You are trying to import a `Gen.Route` module:

4| import Gen.Route as Route exposing (Route)
          ^^^^^^^^^
I checked the "dependencies" and "source-directories" listed in your elm.json,
but I cannot find it! Maybe it is a typo for one of these names?

    Gen.Pages
    Utils.Route
    Api.Data
    Api.Token

Hint: If it is not a typo, check the "dependencies" and "source-directories" of
your elm.json to make sure all the packages you need are listed there!
...

I'm using npm v6.14.11 on a Windows OS.

rosensama commented 3 years ago

Seems it's missing other code, too. I don't see source for Effect, Request, etc. which maybe are in the missing directories?

Looking at file histories, I suspect this is due to rewriting the realworld example for the elm-spa 6.0 betas.

$ elm make
Dependencies ready!         
-- MISSING SOURCE DIRECTORIES ----------------------------------------- elm.json

I need a valid elm.json file, but the "source-directories" field lists the
following directories:

    .elm-spa/defaults
    .elm-spa/generated

I cannot find them though. Are they missing? Are there typos?
rosensama commented 3 years ago

Yep, this is the migration to the elm-spa 6.x betas. To run the example locally: 1) npm install elm-spa@6.0.15--beta -g 2) elm-spa server

setrar commented 3 years ago

Yep, this is the migration to the elm-spa 6.x betas. To run the example locally:

1. `npm install elm-spa@6.0.15--beta -g`

2. `elm-spa server`

Thanks @rosensama, I almost gave up on elm-spa

I tried following the a realworld app with elm-spa blog which I found so interesting.

Coming from a CLI world where I enjoy using:

$ ng generate component ... --skip-tests 

Stumbling on a version issue is somewhat embarrassing

$ npm install elm-spa@latest --global
$ elm-spa --version

elm-spa – version 6.0.4

Commands:
elm-spa new . . . . . . . . .  create a new project
elm-spa add <url> . . . . . . . . create a new page
elm-spa build . . . . . . one-time production build
elm-spa server  . . . . . . start a live dev server

Other commands:
elm-spa gen . . . . generates code without elm make
elm-spa watch . . . .  runs elm-spa gen as you code

Visit https://elm-spa.dev for more!

:bulb: For others having the same issue, you need to upgrade to

$ npm install elm-spa@6.0.15--beta --global
$ elm-spa --version

elm-spa – version 6.0.15--beta

Commands:
elm-spa new . . . . . . . . .  create a new project
elm-spa add <url> . . . . . . . . create a new page
elm-spa build . . . . . . one-time production build
elm-spa watch . . . . . . .  runs build as you code
elm-spa server  . . . . . . start a live dev server

Visit https://elm-spa.dev for more!
$ npm --version
6.14.12
$ node --version
v14.16.1

on a M1 Silicon

Screen Shot 2021-05-17 at 9 04 03 AM