hexojs / hexo

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

ERROR Process failed: layout/category.ejs #2890

Closed ghost closed 6 years ago

ghost commented 6 years ago

IF Windows NodeJS 8.9.2 Hexo 3.4.3 At start Hexo I receive an error:

ERROR Process failed: layout/category.ejs
SyntaxError: Unexpected token ; in "C:\\hexo

layout/category.ejs <h1 itemprop="name" class="hidden-xs"><%= __('page.category') + ': ' + page.category; %></h1>

if you remove ";" that error there is no <h1 itemprop="name" class="hidden-xs"><%= __('page.category') + ': ' + page.category %></h1>

how to fix?

All is normal on Linux

tcrowe commented 6 years ago

The slash is going the wrong way / vs. \

Maybe there is a place requiring path.sep

Do you have a stack trace @geckowebit ?

ghost commented 6 years ago

thanks for the answer in the default theme there are no errors

files did not change

error log $> hexo server

outputs an error but everything works

INFO  Start processing
ERROR Process failed: layout/category.ejs
SyntaxError: Unexpected token ; in "C:\\hexo\\themes\\pure\\layout\\category.ejs
"
    at new Function (<anonymous>)
    at Object.exports.compile (C:\hexo\node_modules\ejs\lib\ejs.js:242:14)
    at Function.ejsRenderer.compile (C:\hexo\node_modules\hexo-renderer-ejs\lib\
renderer.js:11:14)
    at Theme._View.View.View._precompile (C:\hexo\node_modules\hexo\lib\theme\vi
ew.js:119:29)
    at Theme._View.View.View (C:\hexo\node_modules\hexo\lib\theme\view.js:13:8)
    at new Theme._View.View (C:\hexo\node_modules\hexo\lib\theme\index.js:37:10)

    at Theme.setView (C:\hexo\node_modules\hexo\lib\theme\index.js:71:20)
    at C:\hexo\node_modules\hexo\lib\theme\processors\view.js:14:14
    at tryCatcher (C:\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\hexo\node_modules\bluebird\js\relea
se\promise.js:512:31)
    at Promise._settlePromise (C:\hexo\node_modules\bluebird\js\release\promise.
js:569:18)
    at Promise._settlePromise0 (C:\hexo\node_modules\bluebird\js\release\promise
.js:614:10)
    at Promise._settlePromises (C:\hexo\node_modules\bluebird\js\release\promise
.js:693:18)
    at Promise._fulfill (C:\hexo\node_modules\bluebird\js\release\promise.js:638
:18)
    at Promise._resolveCallback (C:\hexo\node_modules\bluebird\js\release\promis
e.js:432:57)
    at Promise._settlePromiseFromHandler (C:\hexo\node_modules\bluebird\js\relea
se\promise.js:524:17)
    at Promise._settlePromise (C:\hexo\node_modules\bluebird\js\release\promise.
js:569:18)
    at Promise._settlePromise0 (C:\hexo\node_modules\bluebird\js\release\promise
.js:614:10)
    at Promise._settlePromises (C:\hexo\node_modules\bluebird\js\release\promise
.js:693:18)
    at Promise._fulfill (C:\hexo\node_modules\bluebird\js\release\promise.js:638
:18)
    at C:\hexo\node_modules\bluebird\js\release\nodeback.js:42:21
    at C:\hexo\node_modules\graceful-fs\graceful-fs.js:78:16
ERROR Process failed: layout/tag.ejs
SyntaxError: Unexpected token ; in "C:\\hexo\\themes\\pure\\layout\\tag.ejs"
    at new Function (<anonymous>)
    at Object.exports.compile (C:\hexo\node_modules\ejs\lib\ejs.js:242:14)
    at Function.ejsRenderer.compile (C:\hexo\node_modules\hexo-renderer-ejs\lib\
renderer.js:11:14)
    at Theme._View.View.View._precompile (C:\hexo\node_modules\hexo\lib\theme\vi
ew.js:119:29)
    at Theme._View.View.View (C:\hexo\node_modules\hexo\lib\theme\view.js:13:8)
    at new Theme._View.View (C:\hexo\node_modules\hexo\lib\theme\index.js:37:10)

    at Theme.setView (C:\hexo\node_modules\hexo\lib\theme\index.js:71:20)
    at C:\hexo\node_modules\hexo\lib\theme\processors\view.js:14:14
    at tryCatcher (C:\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\hexo\node_modules\bluebird\js\relea
se\promise.js:512:31)
    at Promise._settlePromise (C:\hexo\node_modules\bluebird\js\release\promise.
js:569:18)
    at Promise._settlePromise0 (C:\hexo\node_modules\bluebird\js\release\promise
.js:614:10)
    at Promise._settlePromises (C:\hexo\node_modules\bluebird\js\release\promise
.js:693:18)
    at Promise._fulfill (C:\hexo\node_modules\bluebird\js\release\promise.js:638
:18)
    at Promise._resolveCallback (C:\hexo\node_modules\bluebird\js\release\promis
e.js:432:57)
    at Promise._settlePromiseFromHandler (C:\hexo\node_modules\bluebird\js\relea
se\promise.js:524:17)
    at Promise._settlePromise (C:\hexo\node_modules\bluebird\js\release\promise.
js:569:18)
    at Promise._settlePromise0 (C:\hexo\node_modules\bluebird\js\release\promise
.js:614:10)
    at Promise._settlePromises (C:\hexo\node_modules\bluebird\js\release\promise
.js:693:18)
    at Promise._fulfill (C:\hexo\node_modules\bluebird\js\release\promise.js:638
:18)
    at C:\hexo\node_modules\bluebird\js\release\nodeback.js:42:21
    at C:\hexo\node_modules\graceful-fs\graceful-fs.js:78:16
INFO  Hexo is running at http://localhost:4000/. Press Ctrl+C to stop
tcrowe commented 6 years ago

We'll keep an eye on https://github.com/cofess/hexo-theme-pure/issues/20

Hopefully they will also know how to diagnose.

In the meantime try adding the debugging options from ejs: https://github.com/mde/ejs#options

Into the ejs render options: https://github.com/hexojs/hexo-renderer-ejs/blob/master/lib/renderer.js#L12

Maybe it will show you the busted generated JS source.

ghost commented 6 years ago

friends thank you for your answers I replaced node_modules / ejs from Linux and it all worked. It's strange that under Windows this module produces errors