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

install and first run are hard to get right #77

Open
talkingtab opened this issue Feb 17, 2020 · 3 comments
Open

install and first run are hard to get right #77

talkingtab opened this issue Feb 17, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@talkingtab
Copy link

talkingtab commented Feb 17, 2020

ubuntu 19:10

  • download release from github to clean directory
  • chmod +x nodebook*
  • mkdir books
    ./nodebook* web books
    click new, choose nodejs
    click run

`
Ready.
--- Running...
internal/modules/cjs/loader.js:895
throw err;
^
Error: Cannot find module '/other/clones/nodebook/notebook/Waspbutter Robin/notebook/Waspbutter Robin/index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:892:15)
at Function.Module._load (internal/modules/cjs/loader.js:785:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1143:12)
at internal/main/run_main_module.js:16:11 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
exit status 1
--- Done.

`

@talkingtab
Copy link
Author

Command line was .
./nbk web ./books
but it works with
./nbk web /other/work/nbk/books

@netgusto
Copy link
Owner

Yes, I agree, something has to be done there.
For cli mode; It'd also be nice to be able to:

  • run within a notebook (any dir containing one of the recognized entry points) and be able to run it, not just from the root of the notebook hierarchy as it is the case right now

  • detect newly created notebooks (for instance, from vim) and register them / watch them on the fly

@netgusto netgusto added the enhancement New feature or request label Feb 17, 2020
@talkingtab
Copy link
Author

A patch to use the absolute path. In your code the possible error was wrapped but I did not do that so you might want to modify that

diff --git a/src/core/baseservices.go b/src/core/baseservices.go
index f5e56bb..1330570 100644
--- a/src/core/baseservices.go
+++ b/src/core/baseservices.go
@@ -3,6 +3,7 @@ package core
 import (
        "fmt"
        "os"
+    "path/filepath"
 
        "github.com/netgusto/nodebook/src/core/shared/recipe"
        "github.com/netgusto/nodebook/src/core/shared/service"
@@ -14,8 +15,14 @@ func baseServices(notebooksPath string) (*service.RecipeRegistry, *service.Noteb
        recipeRegistry := service.NewRecipeRegistry()
        recipe.AddRecipesToRegistry(recipeRegistry)
 
+    absBookPath, err := filepath.Abs(notebooksPath)
+    if err != nil {
+        fmt.Println("Could not get absolute path")
+        os.Exit(1)
+    }
+
        // Notebook registry
-       nbRegistry := service.NewNotebookRegistry(notebooksPath, recipeRegistry)
+       nbRegistry := service.NewNotebookRegistry(absBookPath, recipeRegistry)
 
        // Find notebooks
        notebooks, err := nbRegistry.FindNotebooks(nbRegistry.GetNotebooksPath())

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

No branches or pull requests

2 participants