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

Document how to recover from corrupted nimble cache #693

Closed
hiteshjasani opened this issue Aug 23, 2019 · 10 comments
Closed

Document how to recover from corrupted nimble cache #693

hiteshjasani opened this issue Aug 23, 2019 · 10 comments

Comments

@hiteshjasani
Copy link
Contributor

I somehow got a situation where my project wouldn't build and gave me the following error:

$ nimble build --verbose                           
     Error: Could not read package info file in /Users/hitesh/dev/nim-d3/example
s/examples.nimble;                                                              
        ...   Reading as ini file failed with:                                  
        ...     Invalid section: .                                              
        ...   Evaluating as NimScript file failed with:                         
        ...                                                                     
        ... printPkgInfo() failed.

After being very confused with this error I stumbled upon the --debug option.

$ nimble build --debug                             
     Debug: Executing nim e --hints:off --verbosity:0 -p:/var/folders/f4/gzyr8mc
n5yv0jvdv5l47zygr0000gn/T/nimblecache /Users/hitesh/dev/nim-d3/examples/examples
_61054.nims /var/folders/f4/gzyr8mcn5yv0jvdv5l47zygr0000gn/T/nimble_61054.out pr
intPkgInfo                                                                      
     Error: Could not read package info file in /Users/hitesh/dev/nim-d3/example
s/examples.nimble;                                                              
        ...   Reading as ini file failed with:                                  
        ...     Invalid section: .                                              
        ...   Evaluating as NimScript file failed with:                         
        ...                                                                     
        ... printPkgInfo() failed.

Deleting the following resolved the issue and my builds succeeded again.

/var/folders/f4/gzyr8mcn5yv0jvdv5l47zygr0000gn/T/nimblecache/*
/var/folders/f4/gzyr8mcn5yv0jvdv5l47zygr0000gn/T/nimble_61054.out

This kind of build failure is not easy to track down unless you know these steps. It would be nice to have nimble be more fault tolerant and not let the user get into this situation in the first place. But at the very least, this should be documented in the troubleshooting section.

@Araq
Copy link
Member

Araq commented Aug 23, 2019

I recently had this error too quite often.

@dom96
Copy link
Collaborator

dom96 commented Aug 24, 2019

Please paste the contents of these files whenever something like this happens to give us a better idea of the cause.

Maybe @genotrance has an idea of what could be causing this?

@hiteshjasani
Copy link
Contributor Author

The .nimble file related to this issue.

# Package

version       = "0.1.0"
author        = "Hitesh Jasani"
description   = "Examples using nim and D3"
license       = "MIT"
srcDir        = "src"
bin           = @["examples"]



# Dependencies

requires "nim >= 0.20.0"
requires "karax"

from os import splitFile, addFileExt

task pages, "Build javascript pages":
  if dirExists("public/js"):
    rmDir("public/js")

  mkDir("public/js")
  for file in listfiles("src/pages/"):
    let fileparts = splitFile(file)
    if fileparts.ext == ".nim":
      let
        opts = "--hints:off"
        jsfile = "public/js/" & fileparts.name.addFileExt("js")
        cmd = "nim js " & opts & " -o:" & jsfile & " " & file
      exec cmd

I don't have this issue anymore after my workaround but if I have it again, I'll post whatever generated files I find.

@genotrance
Copy link
Contributor

genotrance commented Aug 25, 2019

Were you going between different versions of Nim (and nimble as a result) causing you to use older versions of nimble? There are known issues that were fixed over time. If you run into this again, try updating nimble with koch --latest nimble for the Nim version you are currently using and check if the problem persists.

@hiteshjasani
Copy link
Contributor Author

@genotrance Now that you mention it, yes, I do believe that's the case. I was testing using different versions of nimble using nim 0.19.6, stable and head -- using choosenim to switch between them. It's just that once the problem cropped up, switching nim versions did not solve the problem. I also tried commenting out the task section of the example.nimble file but the problem remained until I removed the cache files.

@mratsim
Copy link

mratsim commented Aug 28, 2019

Same issue with Arraymancer. I use choosenim to switch between version and ensure compatibility between stable and devel.

@narimiran
Copy link
Member

Maybe @genotrance has an idea of what could be causing this?

The message in this issue is the same as one as I mistakenly thought it was jester-specific (dom96/jester#207), and the reason for it, at least in my case, was that the warning about unused imports was mistakenly being added to the .ini file.

I'll copy from there the steps I took to solve it on my end:

  1. update your koch: nim c -d:danger koch.nim
  2. use that koch to update nimble: ./koch nimble

@genotrance
Copy link
Contributor

Can this be closed now? Only good outcome of all this is that people can realize that they can freely update nimble even in shipped versions of Nim and get the latest bug fixes and features.

@genotrance
Copy link
Contributor

Worth noting that v0.20.2 that shipped on July 16th was pinned to a Nimble version from June 3rd. The fix for this issue was merged on June 11th. So basically anyone using a stable Nim as of today needs to update their Nimble with koch --latest nimble.

@genotrance
Copy link
Contributor

Closing issue - update to latest nimble as explained above.

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

No branches or pull requests

6 participants