nimble icon indicating copy to clipboard operation
nimble copied to clipboard

nim says "invalid package name"

Open retsyo opened this issue 2 years ago • 5 comments

I always cloned latest nim source and compiled in MSYS2+MingW64 on windows 10 64 bits. Everything is OK months ago. But now, something weired happened

  1. first, the version of nim.exe and nimble.exe
$ nim --v
Nim Compiler Version 1.5.1 [Windows: amd64]
Compiled at 2021-06-26
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 39fbf3c84bd83613407e22b3de215d9a221b9422
active boot switches: -d:release


$ nimble --v
nimble v0.13.1 compiled at 2021-09-15 06:36:34
git hash: 795704833ddfd0cdaefb45c60551d3ea205279ef
  1. I delete C:\Users\USER\.nimble\ totally

  2. the new nim compiler can compile the following a.nim without problem

# a.nim
echo 1

the processing:

$ nim c -r a
Hint: used config file 'E:\msys64\home\USER\_nim\nim\config\nim.cfg' [Conf]
Hint: used config file 'E:\msys64\home\USER\_nim\nim\config\config.nims' [Conf]
...................
CC: stdlib_digitsutils.nim
CC: stdlib_assertions.nim
CC: stdlib_dollars.nim
CC: stdlib_io.nim
CC: stdlib_system.nim
CC: a.nim
Hint:  [Link]
Hint: gc: refc; opt: none (DEBUG BUILD, `-d:release` generates faster code)
26554 lines; 1.454s; 31.953MiB peakmem; proj: a; out: Z:\a.exe [SuccessX]
Hint: Z:\a.exe  [Exec]
1
  1. nimble can install package
$ nimble install listsv
    Prompt: No local packages.json found, download it from internet? [y/N]
y
    Answer: Downloading Official package list
    Success Package list downloaded.
Downloading https://github.com/srwiley/listsv.git using git
   Warning: The package has no tagged releases, downloading HEAD instead.
  Verifying dependencies for [email protected]
 Installing [email protected]
  Success:  listsv installed successfully.

  1. then the strange happens
$ rm a.exe

$ nim c -r a
E:\msys64\home\USER\_nim\nim\config\nim.cfg(51, 1) Error: invalid package name: C:\Users\USER\.nimble\pkgs\listsv-0.1.0-a6dfb9de705011f6d04902493cac04a4f20a0435

I found that the new-installed package is under C:\Users\USER\.nimble\pkgs\listsv-0.1.0-a6dfb9de705011f6d04902493cac04a4f20a0435\ directory. However, I remember it should be listsv-0.1.0. So what happened to nimble?

thanks

retsyo avatar Sep 15 '21 08:09 retsyo

The cause of this is that your Nimble is too new for your compiler :)

Use Nim devel/1.6 or downgrade Nimble and recreate your .nimble directory.

I think this is something we should consider resolving before releasing the new Nimble CC @Araq @bobeff

dom96 avatar Sep 15 '21 10:09 dom96

Related: https://github.com/nim-lang/Nim/issues/18840

narimiran avatar Sep 15 '21 14:09 narimiran

I think this is something we should consider resolving before releasing the new Nimble CC @Araq @bobeff

Also, we should handle better/differently this error:

Error:  You are working with an old version of Nimble cache repository.
Hint:  Please delete your "/home/username/.nimble" directory.

Maybe nimble should do that automatically? Make a backup of that folder, extract package names, delete the folder, populate a new folder with the packages?

narimiran avatar Sep 15 '21 14:09 narimiran

Maybe nimble should do that automatically? Make a backup of that folder, extract package names, delete the folder, populate a new folder with the packages?

@narimiran This was my initial plan, but unfortunately, it cannot happen because the checksum of the package is calculated on the entire package content and not only on the installed files.

The cause of this is that your Nimble is too new for your compiler :)

I think this is something we should consider resolving before releasing the new Nimble

@dom96 Unfortunately the new functionality depends on a commit present only in the latest Nim version, in particular on the functionality added to the nimblecmd.nim file for recognizing the new Nimble cache directory names with hash sums in them.

bobeff avatar Sep 15 '21 18:09 bobeff

I don't think we can release it like this unfortunately. Preventing changing to an older Nim is a showstopper. I'm sure we can resolve this, the question is: how should we do it?

dom96 avatar Sep 17 '21 15:09 dom96