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

Leiningen engine fails to knit without additional plugin #1176

Closed
phillc73 opened this issue Mar 5, 2016 · 2 comments
Closed

Leiningen engine fails to knit without additional plugin #1176

phillc73 opened this issue Mar 5, 2016 · 2 comments
Labels
doc Need to improve documentation
Milestone

Comments

@phillc73
Copy link

phillc73 commented Mar 5, 2016

engine.R indicates that Clojure is supported through the Leiningen REPL

else paste(switch(
    engine, bash = '-c', coffee = '-e', groovy = '-e', lein = 'exec -e',
    mysql = '-e', node = '-e', perl = '-e', psql = '-c', python = '-c',
    ruby = '-e', scala = '-e', sh = '-c', zsh = '-c', NULL
  ), shQuote(paste(options$code, collapse = '\n')))

There is also a pull request in the knitr-examples repository with a Clojure example.

Unfortunately, knitting the example fails.

Error generated is:

processing file: test.Rmd
  |.......                                                          |  11%
  ordinary text without R code

  |..............                                                   |  22%
label: setup (with options) 
List of 1
 $ include: logi FALSE

  |......................                                           |  33%
  ordinary text without R code

  |.............................                                    |  44%
label: unnamed-chunk-1 (with options) 
List of 1
 $ engine: chr "lein"

running: lein  exec -e '(def x "Hello world!")
(println x)'

Quitting from lines 11-13 (test.Rmd) 
Error in engine(options) : 'exec' is not a task. See 'lein help'.

Did you mean this?
         new
         check
Calls: <Anonymous> ... process_group.block -> call_block -> block_exec -> in_dir -> engine
In addition: Warning message:
running command ''lein'  exec -e '(def x "Hello world!")
(println x)' 2>&1' had status 1 
Execution halted

Leiningen is in basic default configuration and the version information is:

Leiningen 2.6.1 on Java 1.8.0_72-internal OpenJDK 64-Bit Server VM

To fix this problem, the lein-exec plugin must be added to the leiningen ~/.lein/profiles.clj file:

{:user {:plugins [[lein-exec "0.3.6"]]}}

Once this is added, the example code chunk renders.

I didn't find this information anywhere else in knitr documentation, and I'm not sure where it should or could be added.

@phillc73 phillc73 changed the title Leiningen engine fails to knit without additional Lein plugin Leiningen engine fails to knit without additional plugin Mar 5, 2016
@yihui yihui added the doc Need to improve documentation label Mar 6, 2016
@yihui yihui added this to the v1.13 milestone Mar 6, 2016
@yihui yihui closed this as completed in ecdca00 Mar 6, 2016
@yihui
Copy link
Owner

yihui commented Mar 6, 2016

Yeah I guess it should be documented. I know nothing about Clojure, though. Thanks!

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
doc Need to improve documentation
Projects
None yet
Development

No branches or pull requests

3 participants
@yihui @phillc73 and others