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

nbb fails to download nbb.edn deps when babashka is not in the PATH #328

Open
ikappaki opened this issue May 23, 2023 · 6 comments
Open

Comments

@ikappaki
Copy link
Contributor

ikappaki commented May 23, 2023

version

nbb v1.2.169

platform

any

problem

nbb fails to download nbb.edn deps when nbb is not in the PATH:

'bb' is not recognized as an internal or external command,
operable program or batch file.

repro

  1. Make sure bb is not in the PATH
  2. Create a nbb.edn file with a single dependency:
{:deps {org.babashka/cli {:mvn/version "0.4.39"}}}
  1. Run npx nbb, nbb fails with the following message:
Downloading dependencies...
'bb' is not recognized as an internal or external command,
operable program or batch file.
Command failed: bb --config c:\issue-nbb-bb-deps\.nbb\.cache\00274e32d7c4c425ff9265bf85fd6e0ea82185c4\deps.edn uberjar c:\cssue-nbb-bb-deps\.nbb\.cache\00274e32d7c4c425ff9265bf85fd6e0ea82185c4\nbb-deps.jar
'bb' is not recognized as an internal or external command,
operable program or batch file.

expected behavior

The documentation does not indicate any requirement for an external program to fulfill certain operation of nbb (unless I've missed it 😅 ), thus the failure is unexpected.

In retrospect and after looking at the code a little, it seems obvious that if nbb is to download clj "packages" from the clojure ecosystem, it will need to tap in to some existing framework to do so. I suppose this framework is maven and thus the need for bb to orcherstarte this?

Possible solution I can think of:

  1. Is it possible to implement the same functionality in pure clojurescript (or using an existing npm package)?
  2. Update documentation to clearly indicate that any clojure deps require bb to be in path.

The problem with requiring bb to be available and able to connect to the internet is that nbb might not work behind corporate firewalls or systems with restricted access to tooling other than node.js and npm packages.

Thanks

@borkdude
Copy link
Collaborator

Is it possible to implement the same functionality in pure clojurescript (or using an existing npm package)?

Yes, it's possible to do this via deps.clj if we decide to port it to Node.js, which is a significant undertaking

Option 2 seems good anyway. PR welcome.

@ikappaki
Copy link
Contributor Author

Is it possible to implement the same functionality in pure clojurescript (or using an existing npm package)?

Yes, it's possible to do this via deps.clj if we decide to port it to Node.js, which is a significant undertaking

Sorry for being pedantic here, in terms of minimal library requirements this would mean porting the tools.deps library (still a mundane tasks due to the jvm only maven library dependency), or is there more to it that requires the full deps.clj functionality?

As another option, would it be possible to package deps.clj or babashka as a npm package and have it as an optional nbb dependency (i.e. the user can npm install it when needed)? I'm thinking from the perspesctive of closed environments here, where the only available tools to begin with is nodejs.

Option 2 seems good anyway. PR welcome.

Will have a look, thanks

@borkdude
Copy link
Collaborator

No, only deps.clj would have to be ported when java is a valid requirement. If java is not a valid requirement, then all of maven etc needs to be ported to JS. Good luck with that :)

1 similar comment
@borkdude
Copy link
Collaborator

No, only deps.clj would have to be ported when java is a valid requirement. If java is not a valid requirement, then all of maven etc needs to be ported to JS. Good luck with that :)

@ikappaki
Copy link
Contributor Author

btw, it appears that the babashka.cli library, which prompted me to open this issue, is already included in nbb, but is not mentioned in the README or doc/api.md. Shall I also drop a line about it in the api file?

I think, even if babashka.cli was mentioned in the api, i would have missed it because the Libraries section which refers to the API doc, is at the bottom of the README file way out of site if you are looking for libraries in particular. do you mind it if i relocate it to a more prominent position, perhaps just before the Dependencies section?

thanks

@borkdude
Copy link
Collaborator

Shall I also drop a line about it in the api file?

Sure!

relocate

Sounds good

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

2 participants