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

Theme doesn't work with hexo 2.8.3 #3

Open
codepreneur opened this issue Nov 2, 2014 · 4 comments
Open

Theme doesn't work with hexo 2.8.3 #3

codepreneur opened this issue Nov 2, 2014 · 4 comments

Comments

@codepreneur
Copy link

When I git clone git@github.com:jaredly/hexium.git themes/hexium then change theme to hexium in _config.yml and then hexo server when I go to the browser I get:

{{! Document Settings }} {{! Page Meta }} {{! Styles'n'Scripts }} {{! Ghost outputs important style and meta data with this tag }} {{ghost_head}} {{! Everything else gets inserted here }} {{{body}}} {{! Ghost outputs important scripts and data with this tag }} {{ghost_foot}} {{! The main JavaScript file for Casper }} {{#if theme.ga_id}} {{/if}}

If I then do npm install hexo-renderer-handlebars --save I get :

Error: Cannot find module 'moment'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/johndoe/test-hexo/themes/hexium/helper/index.js:3:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

If I then npm i moment --save then I get:

TypeError: Cannot read property 'slice' of undefined
    at Object.module.exports.asset (/Users/johndoe/test-hexo/themes/hexium/helper/index.js:19:13)
    at Object.eval (eval at <anonymous> (/Users/johndoe/test-hexo/node_modules/hexo-renderer-handlebars/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:189:23), <anonymous>:43:222)
    at /Users/johndoe/test-hexo/node_modules/hexo-renderer-handlebars/node_modules/handlebars/dist/cjs/handlebars/runtime.js:86:31
    at /Users/johndoe/test-hexo/node_modules/hexo-renderer-handlebars/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:465:21
    at handlebarsRenderer (/Users/johndoe/test-hexo/node_modules/hexo-renderer-handlebars/index.js:32:10)
    at Domain.<anonymous> (/usr/local/lib/node_modules/hexo/lib/extend/renderer.js:78:38)
    at Domain.run (domain.js:197:16)
    at store.(anonymous function) (/usr/local/lib/node_modules/hexo/lib/extend/renderer.js:77:9)
    at /usr/local/lib/node_modules/hexo/lib/core/render.js:96:9
    at fn (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:641:34)

Help :)

@jaredly
Copy link
Owner

jaredly commented Nov 6, 2014

Hmm looks like hexo-handlebars isn't rendering for some reason. Is it
installed?

On Sun, Nov 2, 2014, 6:14 AM Vaidas Mykolaitis notifications@github.com
wrote:

When I git clone git@github.com:jaredly/hexium.git themes/hexium and then hexo
server when I go to the browser I get:

{{! Document Settings }} {{! Page Meta }} {{! Styles'n'Scripts }} {{! Ghost outputs important style and meta data with this tag }} {{ghost_head}} {{! Everything else gets inserted here }} {{{body}}} {{! Ghost outputs important scripts and data with this tag }} {{ghost_foot}} {{! The main JavaScript file for Casper }} {{#if theme.ga_id}} {{/if}}

Help :)


Reply to this email directly or view it on GitHub
#3.

@codepreneur
Copy link
Author

This is my package.json

{
  "name": "hexo-site",
  "version": "2.8.3",
  "private": true,
  "dependencies": {
    "handlebars": "^2.0.0",
    "hexo-renderer-ejs": "*",
    "hexo-renderer-handlebars": "^0.1.1",
    "hexo-renderer-marked": "*",
    "hexo-renderer-stylus": "*",
    "moment": "^2.8.3"
  }
}

@codepreneur
Copy link
Author

I found what the problem was:

<link rel="shortcut icon" href="{{asset theme.favicon}}">

this line of code inside of layout.hbs throws an error because it is undefined so if you comment it out, it works.

@yuvilio
Copy link

yuvilio commented Dec 8, 2014

I can confirm a similar issue on my hexo 2.8.3 instance and @codepreneur's workaround helped. seems the that template line might have caused this error when running hexo generate

$ hexo generate
[info] Files loaded in 0.064s
[error] HexoError: Render failed: archives/index.html
TypeError: Cannot call method 'slice' of undefined
at Object.module.exports.asset (/home/yuvilio/ws/sites/hexo/hexo-hexium/themes/hexium/helper/index.js:19:14)
at Object.eval (eval at <anonymous> (/home/yuvilio/ws/sites/hexo/hexo-hexium/node_modules/hexo-renderer-handlebars/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:189:23), <anonymous>:42:120)
  at /home/yuvilio/ws/sites/hexo/hexo-hexium/node_modules/hexo-renderer-handlebars/node_modules/handlebars/dist/cjs/handlebars/runtime.js:86:31
  at /home/yuvilio/ws/sites/hexo/hexo-hexium/node_modules/hexo-renderer-handlebars/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:465:21
  at handlebarsRenderer (/home/yuvilio/ws/sites/hexo/hexo-hexium/node_modules/hexo-renderer-handlebars/index.js:32:10)
  at /home/yuvilio/.nvm/v0.10.33/lib/node_modules/hexo/lib/extend/renderer.js:78:38
  at b (domain.js:183:18)
  at Domain.run (domain.js:123:23)
  at store.(anonymous function) (/home/yuvilio/.nvm/v0.10.33/lib/node_modules/hexo/lib/extend/renderer.js:77:9)
  at /home/yuvilio/.nvm/v0.10.33/lib/node_modules/hexo/lib/core/render.js:96:9

Also, my hexium's package.json didn't seem to have the packages needed:

$ cat themes/hexium/package.json
{
    "name"        : "Readium",
    "version"     : "2.0.0",
    "description" : "Just a medium-like blogging platform.",
    "author"      : "Sven Read",
    "homepage"    : "http://www.svenread.com/readium"
}
$ cd themes/hexium/
$ ls -lh package.json
-rwxrwxr-x 1 yuvilio yuvilio 212 Dec  8 13:20 package.json
$ npm install
npm WARN package.json Readium@2.0.0 No repository field.
$  

I had to npm install those packages separately for the theme to work:

$ npm install --save handlebars hexo-renderer-handlebars moment

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

3 participants