Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install mint-ui with current instructions and mint 0.20.0 #709

Closed
jhf opened this issue Nov 21, 2024 · 6 comments
Closed

Unable to install mint-ui with current instructions and mint 0.20.0 #709

jhf opened this issue Nov 21, 2024 · 6 comments

Comments

@jhf
Copy link
Contributor

jhf commented Nov 21, 2024

I'm reporting it here since I think it is related to the mint install command handling of ssh vs https.

After mint init I add

"dependencies": {
  "mint-ui": {
    "repository": "https://github.com/mint-lang/mint-ui",
    "constraint": "8.0.0 <= v < 9.0.0"
  }
}

as per the instructions, and then I run mint install and the installation fails with

mint install
Mint - Installing dependencies
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙ Constructing dependency tree...

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

░ ERROR (REPOSITORY_COULD_NOT_UPDATE) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

I could not update the repository: https://github.com/mint-lang/mint-ui.git

The error I got from the git command is this:

fatal: not a git repository (or any of the parent directories): .git

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
There was an error, exiting...

However if I change my dependencies to

  "dependencies": {
    "mint-ui": {
      "repository": "git@github.com:mint-lang/mint-ui.git",
      "constraint": "8.0.0 <= v < 9.0.0"
    }
  }

then mint install is able to resolve mint-ui, but not mint-color, as you see here.

mint install
Mint - Installing dependencies
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙ Constructing dependency tree...
  ✔ Updated mint-ui (git@github.com:mint-lang/mint-ui.git)

⚙ Resolving dependency tree...

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Missing hash key: "mint-color" (KeyError)
  from /Users/jhf/bin/mint in 'Exception::CallStack::unwind:Array(Pointer(Void))'
  from /Users/jhf/bin/mint in 'Exception::CallStack#initialize:Array(Pointer(Void))'
  from /Users/jhf/bin/mint in 'Exception::CallStack::new:Exception::CallStack'
  from /Users/jhf/bin/mint in 'raise<KeyError>:NoReturn'
  from /Users/jhf/bin/mint in 'Hash(String, Mint::Installer::Repository)+@Hash(K, V)#[]<String>:Mint::Installer::Repository'
  from /Users/jhf/bin/mint in 'Mint::Installer#solve<NamedTuple(name: String, version: String)>:Nil'
  from /Users/jhf/bin/mint in 'Mint::Installer#solve<NamedTuple(name: String, version: String)>:Nil'
  from /Users/jhf/bin/mint in 'Mint::Installer#solve:Nil'
  from /Users/jhf/bin/mint in 'Mint::Installer#solve<NamedTuple(name: String, version: String)>:Nil'
  from /Users/jhf/bin/mint in 'Mint::Installer#solve:Nil'
  from /Users/jhf/bin/mint in 'Mint::Installer#initialize:Nil'
  from /Users/jhf/bin/mint in 'Mint::Installer::new:Mint::Installer'
  from /Users/jhf/bin/mint in 'Mint::Cli::Install#run:(Mint::Installer | Nil)'
  from /Users/jhf/bin/mint in 'Mint::Cli::Install#parse_and_run:Nil'
  from /Users/jhf/bin/mint in 'Mint::Cli::Install::run:parent:program_name<Array(Admiral::StringValue), Mint::Cli, String>:Nil'
  from /Users/jhf/bin/mint in 'Mint::Cli::SubCommands#invoke:parent<Array(Admiral::StringValue), Mint::Cli>:Nil'
  from /Users/jhf/bin/mint in 'Mint::Cli::SubCommands::invoke:parent<String, Array(Admiral::StringValue), Mint::Cli>:Nil'
  from /Users/jhf/bin/mint in 'Mint::Cli#sub<String, Array(Admiral::StringValue)>:Nil'
  from /Users/jhf/bin/mint in 'Mint::Cli#parse_and_run:Nil'
  from /Users/jhf/bin/mint in 'Mint::Cli::run:Nil'
  from /Users/jhf/bin/mint in '__crystal_main'
  from /Users/jhf/bin/mint in 'Crystal::main_user_code<Int32, Pointer(Pointer(UInt8))>:Nil'
  from /Users/jhf/bin/mint in 'Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32'
  from /Users/jhf/bin/mint in 'main'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
There was an error, exiting...

When I specify both dependencies with ssh (git@...) then it works.

  "dependencies": {
    "mint-ui": {
      "repository": "git@github.com:mint-lang/mint-ui.git",
      "constraint": "8.0.0 <= v < 9.0.0"
    },
    "mint-color": {
      "repository": "git@github.com:mint-lang/mint-color",
      "constraint": "0.10.0 <= v < 1.0.0"
    }
  }

And mint install works as expected

mint install
Mint - Installing dependencies
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙ Constructing dependency tree...
  ✔ Updated mint-ui (git@github.com:mint-lang/mint-ui.git)
  ✔ Updated mint-color (git@github.com:mint-lang/mint-color)

⚙ Resolving dependency tree...
  ◈ mint-ui ➔ 8.0.0
  ◈ mint-color ➔ 0.10.1

⚙ Copying packages...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All done in 3.218s!

So the support for https for fetching the git repositories seems broken (probably in mint itself).

@jhf
Copy link
Contributor Author

jhf commented Nov 21, 2024

This was very strange, as the git commands directly seem to work correctly for either case

➜  tmp git clone https://github.com/mint-lang/mint-ui.git /tmp/mint-ui-https
Cloning into '/tmp/mint-ui-https'...
remote: Enumerating objects: 1150, done.
remote: Counting objects: 100% (531/531), done.
remote: Compressing objects: 100% (220/220), done.
remote: Total 1150 (delta 365), reused 411 (delta 295), pack-reused 619 (from 1)
Receiving objects: 100% (1150/1150), 468.91 KiB | 3.94 MiB/s, done.
Resolving deltas: 100% (611/611), done.
➜  tmp git clone git@github.com:mint-lang/mint-ui.git /tmp/mint-ui-ssh
Cloning into '/tmp/mint-ui-ssh'...
remote: Enumerating objects: 1150, done.
remote: Counting objects: 100% (531/531), done.
remote: Compressing objects: 100% (220/220), done.
remote: Total 1150 (delta 365), reused 411 (delta 295), pack-reused 619 (from 1)
Receiving objects: 100% (1150/1150), 468.91 KiB | 1.64 MiB/s, done.
Resolving deltas: 100% (611/611), done.

And from the code, you run the local git command.

status, _, error = run "git clone #{url} #{directory}", Dir.current

@gdotdesign
Copy link
Member

Can you check what is in /tmp/mint-packages directories? There should be separate directories for the https one and ssh one like this:

/tmp/mint-packages/
├── git@github.com:mint-lang
│   └── mint-ui
└── https:
    └── github.com

I suspect that for some reason /tmp/mint-packages/https:/github.com/mint-lang/mint-ui.git is invalid.

@jhf
Copy link
Contributor Author

jhf commented Nov 21, 2024

Here is the mint-packages (from macOS)

➜  ~ cd $TMPDIR/mint-packages
➜  mint-packages tree -d
.
├── git@github.com:mint-lang
│   ├── mint-color
│   │   ├── source
│   │   └── tests
│   └── mint-ui.git
│       ├── assets
│       │   ├── fonts
│       │   ├── icons
│       │   └── images
│       ├── source
│       │   ├── Enums
│       │   ├── Extra
│       │   ├── Modules
│       │   └── Records
│       └── test
└── https:
    └── github.com
        └── mint-lang
            ├── mint-color.git
            │   ├── source
            │   └── tests
            └── mint-ui.git
                ├── assets
                │   ├── fonts
                │   ├── icons
                │   └── images
                ├── source
                │   ├── Enums
                │   ├── Extra
                │   ├── Modules
                │   └── Records
                └── test

33 directories

@jhf
Copy link
Contributor Author

jhf commented Nov 21, 2024

And yes, it seems it is not valid

➜  mint-packages cd https:/github.com/mint-lang/mint-ui.git
➜  mint-ui.git ls -lha
total 0
drwxr-xr-x  7 jhf  staff   224B 26 okt 03:48 .
drwxr-xr-x  4 jhf  staff   128B 17 okt 09:13 ..
drwxr-xr-x  7 jhf  staff   224B 26 okt 03:48 .git
drwxr-xr-x  3 jhf  staff    96B 17 okt 09:13 .github
drwxr-xr-x  5 jhf  staff   160B 17 okt 09:13 assets
drwxr-xr-x  6 jhf  staff   192B 26 okt 03:48 source
drwxr-xr-x  2 jhf  staff    64B 26 okt 03:48 test
➜  mint-ui.git git status
fatal: not a git repository (or any of the parent directories): .git

Despite this structure

➜  mint-ui.git tree .git
.git
├── hooks
├── info
├── logs
│   └── refs
│       ├── heads
│       └── remotes
│           └── origin
├── objects
│   ├── info
│   └── pack
└── refs
    ├── heads
    ├── remotes
    │   └── origin
    └── tags

16 directories, 0 files

There seems to be no actual files.

@jhf
Copy link
Contributor Author

jhf commented Nov 21, 2024

I've wiped that directory, and that fixed the problem.

➜  ui git:(feature/mint-prototype) ✗ rm -rf $TMPDIR/mint-packages
➜  ui git:(feature/mint-prototype) ✗ mint install
Mint - Installing dependencies
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙ Constructing dependency tree...
  ✔ Cloned mint-ui (https://github.com/mint-lang/mint-ui.git)
  ✔ Cloned mint-color (https://github.com/mint-lang/mint-color.git)

⚙ Resolving dependency tree...
  ◈ mint-ui ➔ 8.0.0
  ◈ mint-color ➔ 0.9.0

⚙ Copying packages...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All done in 2.121s!

I did try mint tool clean beforehand, to remove any stale state.

➜  ui git:(feature/mint-prototype) ✗ mint tool clean
Mint - Removing directories
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Deleting: .mint
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All done in 29.022ms!

So I'm not sure the hashing of the url will give any benefit - i.e. fix my very strange local error, due to an incorrect checkout, but if it was possible to clean it up, then that would have solved the issue.

@jhf
Copy link
Contributor Author

jhf commented Nov 21, 2024

And I see you have already supported hits, except I didn't come to think of running the clean command with an extra flag.
As you see from my run there, adding --package-cache indeed works correctly and would have fixed my problem.

I think the only sensible improvement would be to add an extra hint if it fails, to try mint tool clean --package-cache at

bold error.to_s.strip

And in that case I would have run the command, and resolved the issue, and so would probably someone else as well.

➜  ui git:(feature/mint-prototype) ✗ mint tool clean --package-cache
Mint - Removing directories
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Deleting: /var/folders/x5/cqfmc09d7gdf_yjcx0lx4dx80000gn/T/mint-packages
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All done in 28.889ms!
➜  ui git:(feature/mint-prototype) ✗ mint install
Mint - Installing dependencies
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙ Constructing dependency tree...
  ✔ Cloned mint-ui (https://github.com/mint-lang/mint-ui.git)
  ✔ Cloned mint-color (https://github.com/mint-lang/mint-color.git)

⚙ Resolving dependency tree...
  ◈ mint-ui ➔ 8.0.0
  ◈ mint-color ➔ 0.9.0

⚙ Copying packages...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All done in 2.129s!

Thank you for your prompt response and feedback. I'll close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants