R Markdown-无法在路径上找到图像

问题描述

我将图像保存在路径TypeError: merge.smart is not a function at Object.<anonymous> (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/config/webpack.prod.js:9:24) at Module._compile (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/v8-compile-cache/v8-compile-cache.js:194:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Module.require (internal/modules/cjs/loader.js:1040:19) at require (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/v8-compile-cache/v8-compile-cache.js:161:20) at WEBPACK_OPTIONS (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13) at requireConfig (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6) at /var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17 at Array.forEach (<anonymous>) at module.exports (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15) at /var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/cli.js:71:45 at Object.parse (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/yargs/yargs.js:576:18) at /var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/cli.js:49:8 at Object.<anonymous> (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/cli.js:366:3) at Module._compile (internal/modules/cjs/loader.js:1151:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Module.require (internal/modules/cjs/loader.js:1040:19) at require (internal/modules/cjs/helpers.js:72:18) at Object.<anonymous> (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack/bin/webpack.js:156:2) at Module._compile (internal/modules/cjs/loader.js:1151:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 error Command Failed with exit code 1. 上。当我将此图像添加到我的R Markdown文件时,我不断收到此消息./static/static/images/air_quality.png

不确定是什么问题。

注意:R markdown文件中给出的路径(No image at path static/images/air_quality.png)是正确的。

我的问题是,为什么无法识别图像?

以下屏幕截图:

enter image description here

解决方法

此pandoc markdown语法![air quality](/static/images/air_quality.png)仅在markdown文件中有效。在使用R Markdown时,我必须将此代码更改为:

```{r air-quality,echo=FALSE,out.width = '100%'}
knitr::include_graphics("/static/images/air_quality.png",error = FALSE)
```
error = FALSE中的

include_graphics()很重要,因为没有该参数,它将引发相同的错误。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...