hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.61k stars 4.87k forks source link

Template render error: (unknown path) #2384

Closed davewx closed 7 years ago

davewx commented 7 years ago

before you submit your issue, please delete all the example code in template

Environment Info

Node version(node -v)

?

Your site _config.yml

...
# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: David Earl Johnson, MSW, LICSW
subtitle: 
description:
author: David Earl Johnson, MSW, LICSW
language: en
timezone: America/Chicago

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://davemsw.com ## not deployed
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: true # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: false
  tab_replace:

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: landscape

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type:

Your theme _config.yml

# Header
menu:
  Home: /
  Archives: /archives
rss: /atom.xml

# Content
excerpt_link: Read More
fancybox: true

# Sidebar
sidebar: right
widgets:
- category
- tag
- tagcloud
- archive
- recent_posts

# display widgets at the bottom of index pages (pagination == 2)
index_widgets:
# - category
# - tagcloud
# - archive

# widget behavior
archive_type: 'monthly'
show_count: false

# Miscellaneous
google_analytics:
favicon: /favicon.png
twitter:
google_plus:
fb_admins:
fb_app_id:

...

Plugin version(npm ls --depth 0)

hexo-site@0.0.0 C:\Users\Dave\work\hexo
+-- hexo@3.2.2
+-- hexo-generator-archive@0.1.4
+-- hexo-generator-category@0.1.3
+-- hexo-generator-index@0.2.0
+-- hexo-generator-tag@0.2.0
+-- hexo-migrator-wordpress@0.1.2
+-- hexo-renderer-ejs@0.2.0
+-- hexo-renderer-marked@0.2.11
+-- hexo-renderer-stylus@0.3.1
`-- hexo-server@0.2.0

For BUG

For question

Hexo newby, new install, error message in the subject line. One of the above items I don't know where to get. Full error message below:

 hexo generate
INFO  Start processing
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: (unknown path) [Line 1, Column 294]
  expected variable end
    at Object.exports.prettifyError (C:\Users\Dave\work\hexo\node_modules\nunjucks\src\lib.js:34:15)
    at new_cls.render (C:\Users\Dave\work\hexo\node_modules\nunjucks\src\environment.js:469:27)
    at new_cls.renderString (C:\Users\Dave\work\hexo\node_modules\nunjucks\src\environment.js:327:21)
    at C:\Users\Dave\work\hexo\node_modules\hexo\lib\extend\tag.js:66:9
    at Promise._execute (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\debuggability.js:300:9)
    at Promise._resolveFromExecutor (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:481:18)
    at new Promise (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:77:14)
    at Tag.render (C:\Users\Dave\work\hexo\node_modules\hexo\lib\extend\tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (C:\Users\Dave\work\hexo\node_modules\hexo\lib\hexo\post.js:253:16)
    at C:\Users\Dave\work\hexo\node_modules\hexo\lib\hexo\render.js:65:19
    at tryCatcher (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:510:31)
    at Promise._settlePromise (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:567:18)
    at Promise._settlePromise0 (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:612:10)
    at Promise._settlePromises (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:691:18)
    at Async._drainQueue (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:649:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)
FATAL (unknown path) [Line 1, Column 294]
  expected variable end
Template render error: (unknown path) [Line 1, Column 294]
  expected variable end
    at Object.exports.prettifyError (C:\Users\Dave\work\hexo\node_modules\nunjucks\src\lib.js:34:15)
    at new_cls.render (C:\Users\Dave\work\hexo\node_modules\nunjucks\src\environment.js:469:27)
    at new_cls.renderString (C:\Users\Dave\work\hexo\node_modules\nunjucks\src\environment.js:327:21)
    at C:\Users\Dave\work\hexo\node_modules\hexo\lib\extend\tag.js:66:9
    at Promise._execute (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\debuggability.js:300:9)
    at Promise._resolveFromExecutor (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:481:18)
    at new Promise (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:77:14)
    at Tag.render (C:\Users\Dave\work\hexo\node_modules\hexo\lib\extend\tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (C:\Users\Dave\work\hexo\node_modules\hexo\lib\hexo\post.js:253:16)
    at C:\Users\Dave\work\hexo\node_modules\hexo\lib\hexo\render.js:65:19
    at tryCatcher (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:510:31)
    at Promise._settlePromise (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:567:18)
    at Promise._settlePromise0 (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:612:10)
    at Promise._settlePromises (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\promise.js:691:18)
    at Async._drainQueue (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (C:\Users\Dave\work\hexo\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:649:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)

For feature request

NoahDragon commented 7 years ago

I assume it is the nunjucks syntax issue in theme layout.

davewx commented 7 years ago

Hmm, so what can I do about it?

NoahDragon commented 7 years ago

Do you modify any theme layout? Or use the nunjucks syntax some where?

davewx commented 7 years ago

I used the template that comes with hexo and I don't know what nunjucks is. I'm using the standard package with hexo, the only things I changed are in the config file included above.

NoahDragon commented 7 years ago

What's the post content? Can you post it here?

davewx commented 7 years ago

I'm using the Wordpress plugin to import 240 posts in a blog. It seems to choke on the first one. Here is the first one:

---
title: 'Youth Suicides Rise the Most in 15 Years, CDC Says'
id: 178
categories:
  - Anti-Depressant Medication
  - Treating Depression
date: 2007-09-06 13:13:49
tags:
---

The CDC has released a report finding a spike in successful suicides in adolescents in 2004\. This increase is the largest increase since 1990\. Is this the result of all the [misinformation](http://blog.davemsw.com/forum/viewforum.php?f=32) floating around anti-depressant medications causing suicide and violence in adolescents and adults? Thats about when the hullabaloo started. So that means that the [increase in suicides](http://www.blog.davemsw.com/archives/2006/04/prescriptions_for_antidepressa.php) may continue into 2007, four years of increased suicide caused by misinformation in the media. It would appear that media sources who print information on such volatile topics need to consult with professionals before doing so.
Perhaps even more importantly, researchers need to be obtaining peer review of their research before going to the media. It's become routine that new research authors send out news releases on topics that will attract media attention. I'm sure part of this is a survival method to make sure the research sponsor benefits from the research and funds them further. But the consequences of such releases need to be carefully considered.
Note that the research process on the risks of anti-depressants have [unequivocally documented](http://www.blog.davemsw.com/archives/2007/01/antidepressants_and_suicide.php) that the risk of anti-depressants is less than the risk of not prescribing.
And don't forget that there is also [a first line of defense](http://www.blog.davemsw.com/archives/2007/06/cognitive_therapy_generally_as_effective_as_medica.php) against depression, called [psychotherapy](http://www.blog.davemsw.com/archives/2005/02/antidepressant_safety_debate_m.php). It's harder to face our problems with others, and sometimes more expensive. But it must be done.
[Bloomberg.com.](http://www.bloomberg.com/apps/news?pid=20601103&sid=al4Po_JOhrzQ&refer=us "Bloomberg.com: U.S.")
> "Suicides among children and young adults in the U.S. rose 8 percent in 2004, the largest single- year increase since 1990, the Centers for Disease Control and Prevention said.
> The biggest percentage jumps were recorded among girls aged 10 to 19, and boys aged 15 to 19, according to a survey released by the agency today. Suicide accounted for 4,599 deaths in 2004, making it the third-leading killer among Americans ages 10 to 24, behind car crashes and homicides, the research found.
> The report, part of an annual analysis by the Atlanta-based CDC, didn't identify a reason for the increase. It found girls mainly hung or suffocated themselves, and that guns remained the primary method used by boys. The rate among Americans ages 10 through 24 had fallen 28 percent since 1990, making the current rise particularly concerning, health officials said.
> [..] One possible reason for the increase may be that doctors are reluctant to prescribe antidepressant drugs to children because of warnings about side effects, said Mark Riddle, director of the division of child and adolescent psychiatry at Johns Hopkins Children's Center in Baltimore.
> ``It's probably reluctance on the part of clinicians to identify and treat kids with depression,'' he said in a telephone interview. ``We know that any treatment for depression in teenagers is quite effective in reducing suicidal thoughts and suicide attempts. When you take away one of the treatments, you are just leaving more kids vulnerable for trouble.''
> [..]An earlier study by CDC researchers found many students in the U.S. regularly contemplate suicide. In that survey, 17 percent of high school students said they ``seriously considered'' killing themselves in the previous 12 months and 13 percent actually devised a suicide plan. Nearly 1 in 10 said they actually tried to take their own life."
NoahDragon commented 7 years ago

The post looks good to me. I tried it on a vanilla install, no issues. Is your website in an open repo, or some place I could take a look at the code?

davewx commented 7 years ago

It resides on my PC. I run it in Win10 using Bash. Attached: hexo.tar.gz

NoahDragon commented 7 years ago

@davewx I think I found the issue. In your coordination-of-care-fractures-medical-system.md file, the following should modify: image

The {{}} is nunjucks syntax, therefore please avoid using them in posts.

davewx commented 7 years ago

Very cool, thanks!

NoahDragon commented 7 years ago

Great. Please feel free to reopen this issue if it still persists.

caili-zhang commented 6 years ago

in my case I just forget to add the youtube word cause the problem right : {% youtube NwH0HvMI4EA %} wrong: {% NwH0HvMI4EA %}

lightnine commented 6 years ago

@davewx I think I found the issue. In your coordination-of-care-fractures-medical-system.md file, the following should modify: image

The {{}} is nunjucks syntax, therefore please avoid using them in posts.

i fix my problem by remove {{ in my one blog. Thanks @NoahDragon

xiaomizhou66 commented 5 years ago

@davewx I think I found the issue. In your coordination-of-care-fractures-medical-system.md file, the following should modify: image

The {{}} is nunjucks syntax, therefore please avoid using them in posts.

正解,也不能在里面使用 .... 会报错

Template render error: (unknown path) [Line 33, Column 95]
  expected name as lookup value, got .