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

Getting file not found errror when setting revealjs setting #6809

Open
Tracked by #6518
hamelsmu opened this issue Sep 12, 2023 · 4 comments
Open
Tracked by #6518

Getting file not found errror when setting revealjs setting #6809

hamelsmu opened this issue Sep 12, 2023 · 4 comments
Assignees
Labels
bug Something isn't working revealjs Issues with the revealjs format triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone.
Milestone

Comments

@hamelsmu
Copy link
Contributor

Bug description

In my _quarto.yml file, if I add these options:

format:
  html:
    code-copy: true
    theme: cosmo
    css: styles.css
+  revealjs: 
+    code-line-numbers: false

I get the following error

ERROR: NotFound: No such file or directory (os error 2), rename '/Users/hamel/github/embed-debug-quarto/1_setup/index.html' -> '/Users/hamel/github/embed-debug-quarto/_site/1_setup/index.html'

NotFound: No such file or directory (os error 2), rename '/Users/hamel/github/embed-debug-quarto/1_setup/index.html' -> '/Users/hamel/github/embed-debug-quarto/_site/1_setup/index.html'
    at Object.renameSync (deno:runtime/js/30_fs.js:175:9)
    at renderProject (file:///Applications/quarto/bin/quarto.js:86832:22)
    at async Command.fn (file:///Applications/quarto/bin/quarto.js:90856:32)
    at async Command.execute (file:///Applications/quarto/bin/quarto.js:8437:13)
    at async quarto (file:///Applications/quarto/bin/quarto.js:127545:5)
    at async file:///Applications/quarto/bin/quarto.js:127563:9

Steps to reproduce

I have made a minimal repro here

I am using Quarto 1.3.450

To repro, do the following:

git clone https://github.com/hamelsmu/embed-debug-quarto.git
quarto render

Expected behavior

No response

Actual behavior

No response

Your environment

  • OS: Mac Ventura 13.4.1
  • Quarto v1.3.450

Quarto check output

[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.1: OK
Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.3.450
Path: /Applications/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
Version: 3.10.12 (Conda)
Path: /Users/hamel/mambaforge/bin/python
Jupyter: 5.3.0
Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
Version: 4.0.4
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.0/Resources/library
knitr: 1.31
rmarkdown: 2.7

[✓] Checking Knitr engine render......OK

cc: @jjallaire @cscheid

@hamelsmu hamelsmu added the bug Something isn't working label Sep 12, 2023
@cscheid
Copy link
Collaborator

cscheid commented Sep 12, 2023

I can repro that here as well. Wild.

@cscheid cscheid added this to the v1.4 milestone Sep 12, 2023
@cscheid cscheid added the revealjs Issues with the revealjs format label Sep 12, 2023
@cscheid cscheid added the triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. label Sep 12, 2023
@cscheid
Copy link
Collaborator

cscheid commented Sep 12, 2023

(I think @dragonstyle did our line numbering support)

@hamelsmu
Copy link
Contributor Author

I can repro that here as well. Wild.

😄 Thank you. I thought I was losing my mind! Hahaha the error didn't make any sense in relation to what I was changing, that is why it took so long for me to isolate this!

@cderv
Copy link
Collaborator

cderv commented Sep 13, 2023

FWIW nothing to do with code-line-numbers as I can repro just by adding revealjs: default to the format with same error

same error message
> quarto render
[1/3] 1_setup\1-setup.qmd
[2/3] 1_setup\index.qmd
[3/3] index.qmd

ERROR: NotFound: Le fichier spécifié est introuvable. (os error 2): rename 'C:\Users\chris\AppData\Local\Temp\quarto\embed-debug-quarto\1_setup\index.html' -> 'C:\Users\chris\AppData\Local\Temp\quarto\embed-debug-quarto\_site\1_setup\index.html'

Stack trace:
    at Object.renameSync (ext:deno_fs/30_fs.js:215:7)
    at renderProject (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/project.ts:332:14)
    at eventLoopTick (ext:core/01_core.js:181:11)
    at async Command.fn (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/cmd.ts:212:26)
    at async Command.execute (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/vendor/deno.land/x/[email protected]/command/command.ts:1790:7)
    at async quarto (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/quarto.ts:135:3)
    at async file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/quarto.ts:167:5

I think what happens is a conflict betwen html and revealjs that both aim to output some HTML files. Those two formats produce HTML so they overwrite each other, but in the case of a project rendering with output-dir set, the moving of file raises an error, because there is only one file to move as both formats have written to the same file.

Here the detailed explanation of why this happens (not sure you are expecting this behavior)

Format metadata merging

Regarding this usage in _quarto.yml, it will be merged with document level format, and I believe this part of the doc is important

Note that when metadata is combined, objects and arrays are merged rather than simply overwriting each other. (...)
The one exception to metadata merging is format. If the document-level YAML defines a format, it must define the complete list of formats to be rendered.

This means to me that if no format is defined at a document level, then both from _quarto.yml level will be used. The file from the error (https://github.com/hamelsmu/embed-debug-quarto/blob/main/1_setup/index.qmd) does not get a format key, so I think it will be rendered to format: html and format: revealjs, and the fact that both produce html makes something trip.

Setting

---
title: "Setup"
order: 1
format: html
---

in the file remove the error.

Also to verify what I am saying you could try not setting a format in the Document level and use pdf in _quarto.yml

format:
  html:
    code-copy: true
    theme: cosmo
    css: styles.css
  pdf: default

After quarto render, a pdf file for 1_setup/index.qmd will be produced.
Now add back the format: html in this qmd file -> No PDF file is rendered at all. The format for pdf defined in _quarto.yml is completely ignored by quarto render because

  • No file use it in their document level
  • No file has no format define as document level.

This happens at

// If the file itself has specified permissible
// formats, filter the list of formats to only
// include those formats
if (file.formats) {
formats = formats.filter((format) => {
return file.formats?.includes(format);
});

This way of merging project formats with other format metadata is the default one - only book project only consider project format only.

About the missing index.html

I believe this is the same as #4470 for revealjs and HTML, and close to #1929 about multiple markdown output format

Quarto currently have no way to track all this correctly and so a format producing .html will overwrite a previous one producing also a .html (Next big improvement probably - #6518)

Error is from

// move the renderedFile to the output dir
if (!renderedFile.isTransient) {
const outputFile = join(formatOutputDir, renderedFile.file);
ensureDirSync(dirname(outputFile));
Deno.renameSync(join(projDir, renderedFile.file), outputFile);
}

and this happens for each output file. format: html and format: revealjs have the same output file, so it errors because there is only one to move

Anyhow, sorry for long post. It is not the first time this happens so now we have a written explanation until #6518 helps us solve all this.

@cderv cderv mentioned this issue Sep 13, 2023
23 tasks
@dragonstyle dragonstyle modified the milestones: v1.4, v1.5 Nov 29, 2023
@cscheid cscheid modified the milestones: v1.5, Future Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working revealjs Issues with the revealjs format triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone.
Projects
None yet
Development

No branches or pull requests

4 participants