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

错误提示 #9

Open
xukuang opened this issue Apr 26, 2017 · 10 comments
Open

错误提示 #9

xukuang opened this issue Apr 26, 2017 · 10 comments

Comments

@xukuang
Copy link

xukuang commented Apr 26, 2017

下载这个项目到自己电脑(window系统)上,什么文件也没有改动,只是打开了bookdown-chinese.Rproj文件,Rstudio就有如下的错误提醒:
[1] "LC_COLLATE=Chinese (Simplified)_People's Republic of China.936;LC_CTYPE=Chinese (Simplified)_People's Republic of China.936;LC_MONETARY=Chinese (Simplified)_People's Republic of China.936;LC_NUMERIC=C;LC_TIME=Chinese (Simplified)_People's Republic of China.936"
Error in yaml::yaml.load(string, ...) :
Scanner error: mapping values are not allowed in this context at line 2, column 7。、

发现Build Book后能正常运行,得到的结果也没问题。不知道这个错误提示是哪里出了问题?

@yihui
Copy link
Owner

yihui commented Apr 26, 2017

吾日三省吾身做了没有:RStudio 最新版?R 最新版?所有 R 包都更新过了?

@xukuang
Copy link
Author

xukuang commented Apr 26, 2017

RStudio升级到 1.0.143,R升级到3.4.0,所有包都升级到最新版(除了foreign包,貌似最新版不支持windows系统,没有升级)。上面的错误提醒依然存在,但运行结果依旧没有问题。对index.Rmd文件中的第二行内容重新输入一遍并从后前逐步删除其中的字符希望找出其中错误。发现当内容改为下面的情形时:
---
title: "麻麻"
author: "张三"
date: "r Sys.Date()"
documentclass: ctexbook
bibliography: [book.bib, packages.bib]
biblio-style: apalike
link-citations: yes
colorlinks: yes
lot: yes
lof: yes
geometry: [b5paper, tmargin=2.5cm, bmargin=2.5cm, lmargin=3.5cm, rmargin=2.5cm]
site: bookdown::bookdown_site
description: "一个简单的中文书示例。"
github-repo: yihui/bookdown-chinese
#cover-image: images/cover.jpg
---
又出现这样的错误提示:
Error in yaml::yaml.load(string, ...) :
Scanner error: while scanning a simple key at line 13, column 1could not find expected ':' at line 14, column 1
此时,删除第14行(description: "一个简单的中文书示例。"),就没有错误提示了。不删除第14行,仍有错误提示。

此外,在使用这个模板时发现,当index.Rmd文件中的title: "《R for Data Science》学习笔记"时也会出现类似的错误提示:

Error in yaml::yaml.load(string, ...) :
Scanner error: mapping values are not allowed in this context at line 2, column 7

而把书名号去掉,即title: "R for Data Science学习笔记"错误提示就会消失。

感觉字符编码遇见windows系统到处都是坑。

@yihui
Copy link
Owner

yihui commented Apr 26, 2017

我找到问题所在了,但我没时间去深究。这个问题不影响你使用 bookdown 或者编译这个例子,所以你可以忽略这个错误。

@xukuang
Copy link
Author

xukuang commented Apr 27, 2017

好的,谢谢

@ShixiangWang
Copy link

我也碰到这个问题了~更新到最新版木有用 😢

@ShixiangWang
Copy link

@yihui
我按照https://bookdown.org/使用publish功能也报错了

> bookdown::publish_book(render = "local")
Error in yaml::yaml.load(string, ...) : 
  Scanner error: mapping values are not allowed in this context at line 2, column 7

@menghaowei
Copy link

你好!我在MacOS下使用build报错,不能够生成PDF文件。

# 报错信息如下
/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS bookdown.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output bookdown.tex --table-of-contents --toc-depth 3 --template latex/template.tex --number-sections --highlight-style tango --latex-engine xelatex --natbib --include-in-header latex/preamble.tex --include-before-body latex/before_body.tex --include-after-body latex/after_body.tex --top-level-division=chapter --variable tables=yes --standalone 
错误: Failed to compile bookdown.tex.
此外: Warning message:
In system2(..., stdout = FALSE, stderr = FALSE) : 调用命令时发生了错误
Please delete bookdown.Rmd after you finish debugging the error.
停止执行

Exited with status 1.
# R版本信息如下
> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] zh_CN.UTF-8/zh_CN.UTF-8/zh_CN.UTF-8/C/zh_CN.UTF-8/zh_CN.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.5.0  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2 htmltools_0.3.6 tools_3.5.0     yaml_2.1.18     Rcpp_0.12.16    stringi_1.1.7   rmarkdown_1.9  
[11] knitr_1.20      stringr_1.3.0   digest_0.6.15   evaluate_0.10.1

@ShixiangWang
Copy link

ShixiangWang commented Apr 28, 2018 via email

@menghaowei
Copy link

搞定了,谢谢!没有装LaTex工具……

@redleafnew
Copy link

redleafnew commented May 31, 2018

现在还是有这个问题,有办法解决吗?
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.5.0 backports_1.1.2 bookdown_0.7 magrittr_1.5 rprojroot_1.3-2 htmltools_0.3.6 tools_3.5.0
[8] yaml_2.1.19 Rcpp_0.12.16 stringi_1.1.7 rmarkdown_1.9 knitr_1.20 xfun_0.1 stringr_1.3.1
[15] digest_0.6.15 evaluate_0.10.1

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

5 participants