mikesol / purescript-deku

A PureScript web UI framework
https://purescript-deku.surge.sh/
Apache License 2.0
123 stars 12 forks source link

Getting started steps results in errors #94

Closed chrissound closed 1 year ago

chrissound commented 1 year ago

Could we not just set a dependency on purescript? Because otherwise I ran into:

$ npx spago install && npm run dev
[error] Oh noes! It looks like the PureScript version installed on your system is not compatible with the package-set you're using.

installed `purs` version:    0.15.6
minimum package-set version: 0.15.8

There are a few ways to solve this:
- install a compatible `purs` version (i.e. in the same 'semver range' as the one in the package set)
- if the `purs` version is 'too new', you can try using `spago upgrade-set` to upgrade to the latest package set
- if you know what you're doing and you want to disable this check, you can override the `version` of the `metadata` package in the packages.dhall, e.g.:

  let upstream = <package-set url here>
  in  upstream
    with metadata.version = "v0.15.6"

Which was easily fixed (though I think it might catch out someone less familiar/experimental) with npm install purescript.

However I run into errors with npm run dev and going to http://localhost:5173:

npx spago install && npm run dev
[info] Installing 75 dependencies.
[info] Searching for packages cache metadata..
[info] Unable to find packages cache metadata, downloading from GitHub..
[info] Installing "debug"
[info] Installing "exceptions"
[info] Installing "bifunctors"
[info] Installing "datetime"
[info] Installing "either"
[info] Installing "exists"
[info] Installing "catenable-lists"
[info] Installing "contravariant"
[info] Installing "control"
[info] Installing "effect"
[info] Installing "const"
[info] Installing "deku"
[info] Installing "enums"
[info] Installing "distributive"
[info] Installing "arrays"
[info] Installing "console"
[info] Installing "aff"
[info] Installing "colors"
[info] Installing "css"
[info] Installing "bolson"
[info] Installing "fast-vect"
[info] Installing "filterable"
[info] Installing "foldable-traversable"
[info] Installing "foreign"
[info] Installing "foreign-object"
[info] Installing "free"
[info] Installing "functions"
[info] Installing "functors"
[info] Installing "gen"
[info] Installing "hyrule"
[info] Installing "identity"
[info] Installing "integers"
[info] Installing "invariant"
[info] Installing "js-date"
[info] Installing "lazy"
[info] Installing "js-timers"
[info] Installing "lcg"
[info] Installing "lists"
[info] Installing "maybe"
[info] Installing "media-types"
[info] Installing "newtype"
[info] Installing "nonempty"
[info] Installing "now"
[info] Installing "nullable"
[info] Installing "numbers"
[info] Installing "ordered-collections"
[info] Installing "orders"
[info] Installing "parallel"
[info] Installing "partial"
[info] Installing "prelude"
[info] Installing "profunctor"
[info] Installing "quickcheck"
[info] Installing "quickcheck-laws"
[info] Installing "random"
[info] Installing "record"
[info] Installing "refs"
[info] Installing "safe-coerce"
[info] Installing "st"
[info] Installing "strings"
[info] Installing "stringutils"
[info] Installing "tailrec"
[info] Installing "these"
[info] Installing "transformers"
[info] Installing "tuples"
[info] Installing "type-equality"
[info] Installing "typelevel-prelude"
[info] Installing "unfoldable"
[info] Installing "unsafe-coerce"
[info] Installing "unsafe-reference"
[info] Installing "web-dom"
[info] Installing "web-events"
[info] Installing "web-file"
[info] Installing "web-html"
[info] Installing "web-storage"
[info] Installing "web-uievents"
[info] Installation complete.

> my-awesome-app@0.0.0 dev
> vite dev

  VITE v3.2.4  ready in 136 ms

  ➜  Local:   http://127.0.0.1:5173/
  ➜  Network: use --host to expose

warn - No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.
warn - https://tailwindcss.com/docs/content-configuration
5:17:52 PM [vite] Internal server error: Failed to resolve import "../output/Main/index.js" from "src/index.js". Does the file exist?
  Plugin: vite:import-analysis
  File: /chris-app/app/my-awesome-app/src/index.js:1:23
  1  |  import { main } from "../output/Main/index.js";
     |                        ^
  2  |  main();
  3  |  
      at formatError (file:///chris-app/app/my-awesome-app/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:39975:46)
      at TransformContext.error (file:///chris-app/app/my-awesome-app/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:39971:19)
      at normalizeUrl (file:///chris-app/app/my-awesome-app/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:36839:33)
      at async TransformContext.transform (file:///chris-app/app/my-awesome-app/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:36972:47)
      at async Object.transform (file:///chris-app/app/my-awesome-app/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:40228:30)
      at async loadAnd
chrissound commented 1 year ago

Seems to be fixed with a npm run build before the npm run dev. Though this wasn't mentioned on the website / docs. I'd submit a PR for this but it seems the docs are in another repo (I'm not sure where).

mikesol commented 1 year ago

Thanks for reporting this!

Could we not just set a dependency on purescript?

Where would the dependency be set? Currently, it's set in package.json of this repo - is there another place where it would have needed to be specified for the project to compile correctly on your machine? Also, when you got that error, were you compiling deku or the starter project?

Seems to be fixed with a npm run build before the npm run dev.

I'll make changes to the docs & report back once everything's in order.

mikesol commented 1 year ago

I've fixed the docs to suggest spago build instead of spago install, and I've also created a postinstall script that runs spago build. Thanks again for reporting this!

chrissound commented 1 year ago

Great thanks! Sorry I forgot to respond to your question:

Where would the dependency be set? Currently, it's set in package.json of this repo - is there another place where it would have needed to be specified for the project to compile correctly on your machine?

I still do not fully understand the packaging between purescript and npm, however I assumed that if purescript is a dependency in package.json, that the right purescript version would be installed with spago install. But according to the first error this seems not to be the case.

Also, when you got that error, were you compiling deku or the starter project?

I think it would have been the starter project. I'm pretty sure I was just reading the docs from https://purescript-deku.netlify.app/

mikesol commented 1 year ago

Thanks! I believe both of these issues are fixed now. Happy Dekuing!

On Mon, 1 May 2023, 20.00 Chris Stryczynski, @.***> wrote:

Great thanks! Sorry I forgot to respond to your question:

Where would the dependency be set? Currently, it's set in package.json of this repo - is there another place where it would have needed to be specified for the project to compile correctly on your machine?

I still do not fully understand the packaging between purescript and npm, however I assumed that if purescript is a dependency in package.json, that the right purescript version would be installed with spago install. But according to the first error this seems not to be the case.

Also, when you got that error, were you compiling deku or the starter project?

I think it would have been the starter project. I'm pretty sure I was just reading the docs from https://purescript-deku.netlify.app/

— Reply to this email directly, view it on GitHub https://github.com/mikesol/purescript-deku/issues/94#issuecomment-1529951226, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEAIJWM66PDSK37ZCATWQTXD7TZJANCNFSM6AAAAAAXHEAWT4 . You are receiving this because you modified the open/close state.Message ID: @.***>