xwmx / nb

CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
https://xwmx.github.io/nb
GNU Affero General Public License v3.0
6.43k stars 181 forks source link

nb browse: Fails to Establish Server Connection on Localhost:6789 #254

Closed toziegler closed 1 year ago

toziegler commented 1 year ago

When executing the nb browse command on the default notebook, the output received suggests a server has started:

Listening: http://localhost:6789
Press any key to exit...

Concurrently, my default browser (Firefox) launches. However, it appears the web server is not successfully running as I am unable to establish a connection.

The issue persists across multiple browsers, including w3m and Firefox. The error message I receive when attempting to load the page with w3m is as follows:

w3m: Can't load http://localhost:6789/home:?--limit=59&--terminal&--columns=250.

Upon investigating the script, I identified that the browse_serve function constructs and executes the following command:

(ncat   --exec /usr/local/bin/nb browse --respond         --keep-open       --listen  localhost 6789       2>/dev/null) &

When this command is manually executed, it returns the error: glob.split is not a function. I am uncertain if this error is directly related to the issue at hand, but have provided it for additional context.

Here are the versions of relevant software I am currently using:

 $ncat --version                                                                                                                                                                                                                  
4.0.2
 $ bash --version                                                                                                                                                                                                                  
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
 $ pandoc --version                                                                                                                                                                                                                
pandoc 3.0.1
xwmx commented 1 year ago

@toziegler Thanks for the detailed report. It looks like you have the ncat from npm, which I didn't realize existed, whereas nb uses ncat from nmap, which is usually available via the ncat or nmap package for your distro, e.g., ncat for ubuntu.

toziegler commented 1 year ago

@xwmx thank you so much for the fast reply! This was exactly the problem and everything is working fine now.