path must be a string,这个问题怎么解决呢,请大家看看吧。。。
发布于 9个月前 作者 wangxuq 778 次浏览

500 TypeError: E:\nodejs\lianxi\microblog\views\index.ejs:14
12| <%- partial(‘say’)%>
13| <%}%>
>> 14| <%- partial(‘posts’)%>
15|


16|

17|

Carbo 說



path must be a string 12| <%- partial(‘say’)%> 13| <%}%>

14| <%- partial(‘posts’)%> 15| 16| 17| Carbo 說 path must be a string at Object.fs.openSync (fs.js:427:18) at Object.fs.readFileSync (fs.js:284:15) at ServerResponse.partial (E:\nodejs\lianxi\microblog\node_modules\express-partials\index.js:309:19) at eval (eval at (E:\nodejs\lianxi\microblog\node_modules\ejs\lib\ejs.js:242:14), :29:496) at eval (eval at (E:\nodejs\lianxi\microblog\node_modules\ejs\lib\ejs.js:242:14), :29:1117) at E:\nodejs\lianxi\microblog\node_modules\ejs\lib\ejs.js:255:15 at Object.exports.render (E:\nodejs\lianxi\microblog\node_modules\ejs\lib\ejs.js:293:13) at View.exports.renderFile [as engine] (E:\nodejs\lianxi\microblog\node_modules\ejs\lib\ejs.js:323:20) at View.render (E:\nodejs\lianxi\microblog\node_modules\express\lib\view.js:76:8) at Function.app.render (E:\nodejs\lianxi\microblog\node_modules\express\lib\application.js:504:10)

2 回复
  • partial(‘posts’)变为 - include posts 可以解决

尽量多用include 吧 之前我也是看例子用的partial 结果各种莫名其妙的错误 换成include就没事儿了,新版本就跟着新版本的语法走吧

回到顶部