expln / rescript-utils

MIT License
0 stars 0 forks source link

After package install, cannot compile. #1

Closed billh0420 closed 1 year ago

billh0420 commented 1 year ago

Am I doing something wrong? Note: I am new to rescript and javascript and vscode?

I installed this package using npm in vscode. When I clean and compile with deps, I get the following error:

npm run rescript-clean && npm run compile-with-deps

game-project@0.1.0 rescript-clean rescript clean -with-deps

Cleaning... 54 files. Cleaning... 236 files. Cleaning... 0 files.

game-project@0.1.0 compile-with-deps rescript build -with-deps

Dependency on @rescript/react rescript: [38/38] src/legacy/ReactDOMRe.cmj rescript: [49/49] install.stamp Dependency on @expln/utils rescript: [108/166] src/main/react-mui-components/Expln_React_Row.cmj FAILED: src/main/react-mui-components/Expln_React_Row.cmj

We've found a bug for you! /Users/hale/ReScript/game-project/node_modules/@expln/utils/src/main/react-mui-components/Expln_React_Row.res:13:6-21

11 │ ~children:option=? 12 │ ) => { 13 │ <Expln_React_Grid ref=?gridRef container=true direction=#row ?justi │ fyContent ?alignItems spacing ?style > 14 │ {switch children { 15 │ | Some(children) =>

The value createElement can't be found in Expln_React_Grid

rescript: [158/166] src/main/react-components/Expln_React_TextFileReader.cmj FAILED: src/main/react-components/Expln_React_TextFileReader.cmj

billh0420 commented 1 year ago

Also, I notices that the rpm registry lists 12 dependencies for this package. But, the following were not installed:

expln commented 1 year ago

I've just fixed a compilation error. But it was not what you mentioned. The error you mentioned looks strange, I don't understand what happens in your case. I would suggest you to install the project again, but start doing it from the command line and then open from VS code.

I successfully executed all the below commands just before writing this response:

  1. Clone the project to some place on your computer (I used windows cmd.exe tool to execute this and all the following commands; but I think they should work on Mac and Linux too) git clone https://github.com/expln/rescript-utils.git
  2. Change directory to the newly created one cd ./rescript-utils
  3. Install all required npm dependencies npm install
  4. Compile and run tests npm run compile-with-deps-and-test

If everything is ok, then you may proceed with opening the project with VS code (File -> Open Folder... and select the "rescript-utils" folder created on the 1st step).

If you still have an error, please let me know.

Please, also note that metamath-lamp no longer depends on this project. However, you still may use it if you need some functionality in it - it contains a lot less of code and may be easier to experiment with.

billh0420 commented 1 year ago

A) @expln said "note that metamath-lamp no longer depends on this project." I didn't realize that. I downloaded a couple of days ago the zip version of metamath-lamp so that I could add some code to see how things worked. This was not linked to the repository (or my clone of your repository) since I had no intentions of uploading my changes (since my changes were for personal understanding of the code).

B) I wanted to learn how the ui worked in metamath-lamp. So I set up an initial project (called "game") and I then used npm to install the expln/utils package so that I could experiment with it. I did not clone expln/utils and then add my code: that didn't seem to be the normal way to handle a package. The package should go into "node_modules" folder and my code for "game" should go into the "src" folder.

C) Since this package is not used in metamath-lamp and I just installed it to learn how to use it for metamath-lamp, I won't pursue this any further. I now have to see how ui is now done in metamath-lamp.

expln commented 1 year ago

Ok, that makes sense.

Just in case you need, please find a similar sequence of commands for metamath-lamp. The last command runs the app locally, on http://localhost:3000/ by default.

  1. git clone https://github.com/expln/metamath-lamp.git
  2. cd ./metamath-lamp
  3. git checkout develop
  4. npm install
  5. npm run compile-with-deps
  6. npm run compile-test-all-unit
  7. npm run start

Since you are writing that you are new to javascript, I would advise you to start by understanding how React works. Without understanding React it will be difficult to understand how the ui works in metamath-lamp. The official React site https://react.dev/learn could be a good start point, however, there are a lot of other good resources in the Internet too.

I am closing this issue since looks like everything is resolved.