xcatliu / hexo-theme-wiki-i18n

A hexo theme for i18n wiki site
http://js-index.com/
28 stars 2 forks source link

Compatibility problem with bluebird? #2

Open JLKM opened 8 years ago

JLKM commented 8 years ago

Really nice, you've launched an i18n-theme for Hexo without a lot of dependencies

But it just won't work for me - not in Windows - not in Linux. Have tried to install the two necessary plugins hexo-generator-index-i18n hexo-generator-archive-alphabet-i18n both in Hexo and further down under the wiki-i18n-theme, but same bad result.

A lot of errors occur in bluebird (which hasn't failed before) and the layout-files. Please see below.

The errors even continue after having switch back to the previous theme. Nothing works before a total roll-back.

Still I would really like to use your solution.

$ hexo g --debug
10:49:47.719 DEBUG Hexo version: 3.2.2
10:49:47.719 DEBUG Working directory: D:\vscode\hexo\odense\
10:49:47.913 DEBUG Config loaded: D:\vscode\hexo\odense\_config.yml
10:49:47.932 DEBUG Script loaded: themes\wiki-i18n\scripts\hexo-helpers.js
10:49:47.932 DEBUG Plugin loaded: hexo-algoliasearch
10:49:47.932 DEBUG Plugin loaded: hexo-generator-archive
10:49:47.979 DEBUG Plugin loaded: hexo-admin
10:49:47.979 DEBUG Plugin loaded: hexo-generator-archive-alphabet-i18n
10:49:47.995 DEBUG Plugin loaded: hexo-generator-category
10:49:47.995 DEBUG Plugin loaded: hexo-generator-index
10:49:47.995 DEBUG Plugin loaded: hexo-renderer-ejs
10:49:47.995 DEBUG Plugin loaded: hexo-generator-index-i18n
10:49:47.995 DEBUG Plugin loaded: hexo-generator-tag
10:49:48.012 DEBUG Plugin loaded: hexo-renderer-stylus
10:49:48.021 DEBUG Plugin loaded: hexo-renderer-marked
10:49:48.057 DEBUG Plugin loaded: hexo-server
10:49:48.057 DEBUG Loading database.
10:49:49.070 INFO  Start processing
10:49:50.107 DEBUG Processed: _posts/hello-world.md
10:49:50.107 DEBUG Processed: _posts/test-med-kategori.md
10:49:50.107 DEBUG Processed: _posts/ny-test.md
10:49:50.107 DEBUG Processed: _posts/st-med-lang.md
10:49:50.107 DEBUG Processed: _posts/testindlaeg-med-Icarus.md
10:49:50.107 DEBUG Processed: _drafts/Ny-test.md
10:49:50.107 DEBUG Processed: _posts/Ny-test.md
10:49:50.107 DEBUG Processed: all-categories/index.md
10:49:50.107 DEBUG Processed: all-tags/index.md
10:49:50.107 DEBUG Processed: _drafts/Testindlaeg-med-Icarus.md
10:49:50.107 DEBUG Processed: _posts/Testindlaeg-med-Icarus.md
10:49:50.107 DEBUG Processed: _posts/estindlaeg-med-Icarus.md
10:49:50.107 DEBUG Processed: _drafts/Test-med-kategori.md
10:49:50.107 DEBUG Processed: _posts/Test-med-kategori.md
10:49:50.107 DEBUG Processed: _posts/est-med-kategori.md
10:49:50.107 DEBUG Processed: _posts/source/procedurer/test-med-kategori.md
10:49:50.107 DEBUG Processed: _posts/source/personale/testindlaeg-med-Icarus.md
10:49:50.107 DEBUG Processed: personale/testindlaeg-med-Icarus.md
10:49:50.107 DEBUG Processed: procedurer/test-med-kategori.md
10:49:50.107 DEBUG Processed: _drafts/test-med-lang.md
10:49:50.107 DEBUG Processed: _posts/test-med-lang.md
10:49:50.107 DEBUG Processed: _posts/est-med-lang.md
10:49:50.410 DEBUG Theme config loaded.
10:49:50.411 DEBUG Processed: _config.yml
10:49:50.615 DEBUG Processed: source/css/normalize.css
10:49:50.615 DEBUG Processed: source/css/index.scss
10:49:50.615 DEBUG Processed: source/images/pixels.png
10:49:50.615 DEBUG Processed: source/js/header.js
10:49:50.740 DEBUG Processed: languages/zh-CN.yml
10:49:50.740 DEBUG Processed: languages/en.yml
10:49:50.740 DEBUG Processed: languages/ja.yml
10:49:50.834 DEBUG Processed: layout/index.ejs
10:49:50.834 DEBUG Processed: layout/archive.ejs
10:49:50.834 DEBUG Processed: layout/post.ejs
10:49:51.115 DEBUG Processed: layout/_partial/article.ejs
10:49:51.115 DEBUG Processed: layout/_partial/ga.ejs
10:49:51.115 DEBUG Processed: layout/_partial/head.ejs
10:49:51.115 DEBUG Processed: layout/_partial/cards.ejs
10:49:51.115 DEBUG Processed: layout/_partial/jumbotron.ejs
10:49:51.115 DEBUG Processed: layout/_partial/words.ejs
10:49:51.115 DEBUG Processed: layout/_partial/header.ejs
10:49:51.115 DEBUG Processed: layout/_partial/scripts.ejs
10:49:51.115 DEBUG Processed: layout/_partial/footer.ejs
10:49:51.662 DEBUG Generator: page
10:49:51.662 DEBUG Generator: post
10:49:51.662 DEBUG Generator: category
10:49:51.662 DEBUG Generator: index
10:49:51.662 DEBUG Generator: tag
10:49:51.662 FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
TypeError: config.language.filter is not a function
    at Hexo.<anonymous> (D:\vscode\hexo\odense\node_modules\hexo-generator-archive-alphabet-i18n\index.js:63:19)
    at Hexo.tryCatcher (D:\vscode\hexo\odense\node_modules\bluebird\js\release\util.js:16:23)
    at Hexo.<anonymous> (D:\vscode\hexo\odense\node_modules\bluebird\js\release\method.js:15:34)
    at D:\vscode\hexo\odense\node_modules\hexo\lib\hexo\index.js:337:24
    at tryCatcher (D:\vscode\hexo\odense\node_modules\bluebird\js\release\util.js:16:23)
    at MappingPromiseArray._promiseFulfilled (D:\vscode\hexo\odense\node_modules\bluebird\js\release\map.js:57:38)
    at MappingPromiseArray.PromiseArray._iterate (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise_array.js:113:31)
    at MappingPromiseArray.init (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise_array.js:77:10)
    at new MappingPromiseArray (D:\vscode\hexo\odense\node_modules\bluebird\js\release\map.js:25:10)
    at map (D:\vscode\hexo\odense\node_modules\bluebird\js\release\map.js:152:12)
    at Function.Promise.map (D:\vscode\hexo\odense\node_modules\bluebird\js\release\map.js:160:12)
    at D:\vscode\hexo\odense\node_modules\hexo\lib\hexo\index.js:334:20
    at tryCatcher (D:\vscode\hexo\odense\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise.js:504:31)
    at Promise._settlePromise (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise.js:561:18)
    at Promise._settlePromise0 (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise.js:606:10)
    at Promise._settlePromises (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise.js:685:18)
    at Async._drainQueue (D:\vscode\hexo\odense\node_modules\bluebird\js\release\async.js:138:16)
    at Async._drainQueues (D:\vscode\hexo\odense\node_modules\bluebird\js\release\async.js:148:10)
    at Immediate.Async.drainQueues (D:\vscode\hexo\odense\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:570:20)
    at tryOnImmediate (timers.js:550:5)
10:49:52.055 DEBUG Generator: asset
10:49:52.055 DEBUG Database saved
10:49:52.070 FATAL config.language.filter is not a function
TypeError: config.language.filter is not a function
    at Hexo.<anonymous> (D:\vscode\hexo\odense\node_modules\hexo-generator-archive-alphabet-i18n\index.js:63:19)
    at Hexo.tryCatcher (D:\vscode\hexo\odense\node_modules\bluebird\js\release\util.js:16:23)
    at Hexo.<anonymous> (D:\vscode\hexo\odense\node_modules\bluebird\js\release\method.js:15:34)
    at D:\vscode\hexo\odense\node_modules\hexo\lib\hexo\index.js:337:24
    at tryCatcher (D:\vscode\hexo\odense\node_modules\bluebird\js\release\util.js:16:23)
    at MappingPromiseArray._promiseFulfilled (D:\vscode\hexo\odense\node_modules\bluebird\js\release\map.js:57:38)
    at MappingPromiseArray.PromiseArray._iterate (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise_array.js:113:31)
    at MappingPromiseArray.init (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise_array.js:77:10)
    at new MappingPromiseArray (D:\vscode\hexo\odense\node_modules\bluebird\js\release\map.js:25:10)
    at map (D:\vscode\hexo\odense\node_modules\bluebird\js\release\map.js:152:12)
    at Function.Promise.map (D:\vscode\hexo\odense\node_modules\bluebird\js\release\map.js:160:12)
    at D:\vscode\hexo\odense\node_modules\hexo\lib\hexo\index.js:334:20
    at tryCatcher (D:\vscode\hexo\odense\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise.js:504:31)
    at Promise._settlePromise (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise.js:561:18)
    at Promise._settlePromise0 (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise.js:606:10)
    at Promise._settlePromises (D:\vscode\hexo\odense\node_modules\bluebird\js\release\promise.js:685:18)
    at Async._drainQueue (D:\vscode\hexo\odense\node_modules\bluebird\js\release\async.js:138:16)
    at Async._drainQueues (D:\vscode\hexo\odense\node_modules\bluebird\js\release\async.js:148:10)
    at Immediate.Async.drainQueues (D:\vscode\hexo\odense\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:570:20)
    at tryOnImmediate (timers.js:550:5)
$ hexo server
INFO  Start processing
INFO  Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.
Unhandled rejection TypeError: D:\vscode\hexo\odense\themes\wiki-i18n\layout\index.ejs:5
    3| <%- partial('_partial/head') %>
    4|   <body>
 >> 5|   <%- partial('_partial/header') %>
    6|   <%- partial('_partial/jumbotron') %>
    7|   <%- partial('_partial/cards', {
    8|     title: __('new'),

D:\vscode\hexo\odense\themes\wiki-i18n\layout\_partial\header.ejs:30
    28|         <% if (is_root()) { %>
    29|           <option disabled selected value class="hidden">Choose a language</option>
 >> 30|           <% get_langs().forEach(lang => { %>
    31|             <option value="<%= lang %>" data-href="<%= switch_lang(lang) %>"><%= site.data.languages[lang] %></option>
    32|           <% }) %>
    33|         <% } else { %>

this.config.language.filter is not a function
    at Object.getLangs (D:\vscode\hexo\odense\themes\wiki-i18n\scripts\hexo-helpers.js:12:31)
    at Object.wrapper [as get_langs] (D:\vscode\hexo\Odense\node_modules\lodash\lodash.js:4597:19)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:1850)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:2821)
    at D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:255:15
    at _compiledSync (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:122:20)
    at View.renderSync (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:50:21)
    at Object.partial (D:\vscode\hexo\Odense\node_modules\hexo\lib\plugins\helper\partial.js:42:17)
    at Object.wrapper (D:\vscode\hexo\Odense\node_modules\lodash\lodash.js:4597:19)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:126)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:33:157)
    at D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:255:15
    at _compiled (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:127:30)
    at View.render (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:29:15)
    at D:\vscode\hexo\Odense\node_modules\hexo\lib\hexo\index.js:387:25
    at tryCatcher (D:\vscode\hexo\Odense\node_modules\bluebird\js\release\util.js:16:23)
    at D:\vscode\hexo\Odense\node_modules\bluebird\js\release\method.js:15:34
    at RouteStream._read (D:\vscode\hexo\Odense\node_modules\hexo\lib\hexo\router.js:134:3)
    at RouteStream.Readable.read (_stream_readable.js:349:10)
    at resume_ (_stream_readable.js:738:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
xcatliu commented 8 years ago

Hi, glad to see you using this theme!

As far as I can see, there seems like you didn't configure language? Can you please check the _config.yml file in your hexo blog root dir?

Here is the sample config: https://github.com/xcatliu/js-index/blob/master/_config.yml#L11

BTW, which version of node and npm do you use?

JLKM commented 8 years ago

Thank you very much for your quick answer. In the same spirit I've made a clean and new installation and posted the whole log below.

Directory structure:
Hexo-root-folder
- node_modules
- public
- scaffolds
- source
- - _drafts
- - - da
- - - en
- - - de
- - _posts
- - - da
- - - en
- - - de
- - - themes
- - - - wiki-i18n
- - - - other-themes

The structure should be reflected in Hexo's root _config.yml:

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

# Site
title: Hexo
subtitle:
description:
author: Jan Larsen
language:
- en
- da
- de
timezone:

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite.com
root: /
permalink: :lang/: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: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: true
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: false
  tab_replace:

# Custom addition - login for hexo-admin - password https://www.bcrypt-generator.com/
admin:
  username: jala
  password_hash: ************ deleted ******************
  secret: *************** deleted *****************

# Custom addition - SEO-keywords for all pages
## keywords:
##  Morten Læburgh Larsen
##  Blog

# 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: DD-MM-YYYY
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: wiki-i18n

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

The new installation didn't work out better than the previous. Good old "bluebird" is still in the log, and no files get generated in the public folder.

The installation runs local on Windows, Node 6.3.1, npm 3.8.1.

Really hope, you can find the needle in this haystack. Good luck from Denmark.

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense
$ git clone https://github.com/xcatliu/hexo-theme-wiki-i18n.git /d/vscode/hexo/odense/themes/wiki-i18n
Cloning into 'D:/vscode/hexo/odense/themes/wiki-i18n'...
remote: Counting objects: 59, done.
remote: Total 59 (delta 0), reused 0 (delta 0), pack-reused 59
Unpacking objects: 100% (59/59), done.
Checking connectivity... done.

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense
$ npm install hexo-generator-index-i18n --save
hexo-site@0.0.0 D:\vscode\hexo\odense
`-- hexo-generator-index-i18n@0.1.1
  `-- hexo-pagination@0.1.0

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense
$ npm install hexo-generator-archive-alphabet-i18n --save
hexo-site@0.0.0 D:\vscode\hexo\odense
`-- hexo-generator-archive-alphabet-i18n@0.1.0
  +-- hexo-pagination@0.1.0
  `-- transliteration@1.1.6
    `-- yargs@4.8.1
      +-- get-caller-file@1.0.1
      +-- lodash.assign@4.1.0
      +-- read-pkg-up@1.0.1
      | +-- find-up@1.1.2
      | | `-- path-exists@2.1.0
      | `-- read-pkg@1.1.0
      |   +-- load-json-file@1.1.0
      |   | +-- parse-json@2.2.0
      |   | | `-- error-ex@1.3.0
      |   | |   `-- is-arrayish@0.2.1
      |   | +-- pify@2.3.0
      |   | `-- strip-bom@2.0.0
      |   |   `-- is-utf8@0.2.1
      |   +-- normalize-package-data@2.3.5
      |   | +-- hosted-git-info@2.1.5
      |   | +-- is-builtin-module@1.0.0
      |   | | `-- builtin-modules@1.1.1
      |   | `-- validate-npm-package-license@3.0.1
      |   |   +-- spdx-correct@1.0.2
      |   |   | `-- spdx-license-ids@1.2.2
      |   |   `-- spdx-expression-parse@1.0.2
      |   |     `-- spdx-exceptions@1.0.5
      |   `-- path-type@1.1.0
      +-- require-directory@2.1.1
      +-- require-main-filename@1.0.1
      +-- set-blocking@2.0.0
      +-- which-module@1.0.0
      +-- window-size@0.2.0
      `-- yargs-parser@2.4.1
        `-- camelcase@3.0.0

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense
$ cd themes/wiki-i18n

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense/themes/wiki-i18n (master)
$ npm install
hexo-theme-wiki-i18n@0.1.0 D:\vscode\hexo\odense\themes\wiki-i18n
+-- eslint@2.13.1
| +-- chalk@1.1.3
| | +-- ansi-styles@2.2.1
| | +-- escape-string-regexp@1.0.5
| | +-- has-ansi@2.0.0
| | +-- strip-ansi@3.0.1
| | `-- supports-color@2.0.0
| +-- concat-stream@1.5.1
| | +-- inherits@2.0.1
| | +-- readable-stream@2.0.6
| | | +-- core-util-is@1.0.2
| | | +-- process-nextick-args@1.0.7
| | | +-- string_decoder@0.10.31
| | | `-- util-deprecate@1.0.2
| | `-- typedarray@0.0.6
| +-- debug@2.2.0
| | `-- ms@0.7.1
| +-- doctrine@1.2.2
| | +-- esutils@1.1.6
| | `-- isarray@1.0.0
| +-- es6-map@0.1.4
| | +-- d@0.1.1
| | +-- es5-ext@0.10.12
| | +-- es6-iterator@2.0.0
| | +-- es6-symbol@3.1.0
| | `-- event-emitter@0.3.4
| +-- escope@3.6.0
| | +-- es6-weak-map@2.0.1
| | `-- esrecurse@4.1.0
| |   `-- estraverse@4.1.1
| +-- espree@3.1.7
| | +-- acorn@3.3.0
| | `-- acorn-jsx@3.0.1
| +-- estraverse@4.2.0
| +-- esutils@2.0.2
| +-- file-entry-cache@1.3.1
| | `-- flat-cache@1.2.1
| |   +-- circular-json@0.3.1
| |   +-- del@2.2.1
| |   | +-- globby@5.0.0
| |   | | +-- array-union@1.0.2
| |   | | | `-- array-uniq@1.0.3
| |   | | `-- arrify@1.0.1
| |   | +-- is-path-cwd@1.0.0
| |   | +-- is-path-in-cwd@1.0.0
| |   | | `-- is-path-inside@1.0.0
| |   | +-- pify@2.3.0
| |   | `-- rimraf@2.5.4
| |   +-- graceful-fs@4.1.5
| |   `-- write@0.2.1
| +-- glob@7.0.5
| | +-- fs.realpath@1.0.0
| | +-- inflight@1.0.5
| | | `-- wrappy@1.0.2
| | +-- minimatch@3.0.2
| | | `-- brace-expansion@1.1.6
| | |   +-- balanced-match@0.4.2
| | |   `-- concat-map@0.0.1
| | `-- once@1.3.3
| +-- globals@9.9.0
| +-- ignore@3.1.3
| +-- imurmurhash@0.1.4
| +-- inquirer@0.12.0
| | +-- ansi-escapes@1.4.0
| | +-- ansi-regex@2.0.0
| | +-- cli-cursor@1.0.2
| | | `-- restore-cursor@1.0.1
| | |   +-- exit-hook@1.1.1
| | |   `-- onetime@1.1.0
| | +-- cli-width@2.1.0
| | +-- figures@1.7.0
| | +-- readline2@1.0.1
| | | +-- code-point-at@1.0.0
| | | | `-- number-is-nan@1.0.0
| | | +-- is-fullwidth-code-point@1.0.0
| | | `-- mute-stream@0.0.5
| | +-- run-async@0.1.0
| | +-- rx-lite@3.1.2
| | +-- string-width@1.0.1
| | `-- through@2.3.8
| +-- is-my-json-valid@2.13.1
| | +-- generate-function@2.0.0
| | +-- generate-object-property@1.2.0
| | | `-- is-property@1.0.2
| | +-- jsonpointer@2.0.0
| | `-- xtend@4.0.1
| +-- is-resolvable@1.0.0
| | `-- tryit@1.0.2
| +-- js-yaml@3.6.1
| | +-- argparse@1.0.7
| | | `-- sprintf-js@1.0.3
| | `-- esprima@2.7.2
| +-- json-stable-stringify@1.0.1
| | `-- jsonify@0.0.0
| +-- levn@0.3.0
| | +-- prelude-ls@1.1.2
| | `-- type-check@0.3.2
| +-- lodash@4.14.1
| +-- mkdirp@0.5.1
| | `-- minimist@0.0.8
| +-- optionator@0.8.1
| | +-- deep-is@0.1.3
| | +-- fast-levenshtein@1.1.4
| | `-- wordwrap@1.0.0
| +-- path-is-absolute@1.0.0
| +-- path-is-inside@1.0.1
| +-- pluralize@1.2.1
| +-- progress@1.1.8
| +-- require-uncached@1.0.2
| | +-- caller-path@0.1.0
| | | `-- callsites@0.2.0
| | `-- resolve-from@1.0.1
| +-- shelljs@0.6.0
| +-- strip-json-comments@1.0.4
| +-- table@3.7.8
| | +-- bluebird@3.4.1
| | +-- slice-ansi@0.0.4
| | +-- tv4@1.2.7
| | `-- xregexp@3.1.1
| +-- text-table@0.2.0
| `-- user-home@2.0.0
|   `-- os-homedir@1.0.1
+-- eslint-config-airbnb-base@3.0.1
`-- eslint-plugin-import@1.12.0
  +-- builtin-modules@1.1.1
  +-- contains-path@0.1.0
  +-- es6-set@0.1.4
  +-- eslint-import-resolver-node@0.2.2
  | `-- resolve@1.1.7
  +-- lodash.cond@4.5.1
  +-- lodash.endswith@4.2.0
  +-- lodash.find@4.5.1
  +-- lodash.findindex@4.5.1
  +-- object-assign@4.1.0
  +-- pkg-dir@1.0.0
  | `-- find-up@1.1.2
  |   +-- path-exists@2.1.0
  |   `-- pinkie-promise@2.0.1
  |     `-- pinkie@2.0.4
  `-- pkg-up@1.0.0

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense/themes/wiki-i18n (master)
$ cd ..

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense/themes
$ cd ..

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense
$ npm install
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense
$ hexo clean
INFO  Deleted database.
INFO  Deleted public folder.

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense
$ hexo g --debug
14:40:24.252 DEBUG Hexo version: 3.2.2
14:40:24.252 DEBUG Working directory: D:\vscode\hexo\odense\
14:40:24.440 DEBUG Config loaded: D:\vscode\hexo\odense\_config.yml
14:40:24.459 DEBUG Script loaded: themes\wiki-i18n\scripts\hexo-helpers.js
14:40:24.506 DEBUG Plugin loaded: hexo-admin
14:40:24.508 DEBUG Plugin loaded: hexo-algoliasearch
14:40:24.513 DEBUG Plugin loaded: hexo-generator-archive
14:40:24.517 DEBUG Plugin loaded: hexo-generator-category
14:40:24.525 DEBUG Plugin loaded: hexo-generator-archive-alphabet-i18n
14:40:24.527 DEBUG Plugin loaded: hexo-generator-index-i18n
14:40:24.529 DEBUG Plugin loaded: hexo-generator-tag
14:40:24.535 DEBUG Plugin loaded: hexo-renderer-ejs
14:40:24.538 DEBUG Plugin loaded: hexo-generator-index
14:40:24.548 DEBUG Plugin loaded: hexo-renderer-marked
14:40:24.596 DEBUG Plugin loaded: hexo-server
14:40:24.598 DEBUG Plugin loaded: hexo-renderer-stylus
14:40:24.600 DEBUG Loading database.
14:40:24.610 INFO  Start processing
14:40:25.732 DEBUG Theme config loaded.
14:40:25.732 DEBUG Processed: _config.yml
14:40:25.738 DEBUG Processed: source/js/header.js
14:40:25.738 DEBUG Processed: source/css/normalize.css
14:40:25.738 DEBUG Processed: source/css/index.scss
14:40:25.738 DEBUG Processed: source/images/pixels.png
14:40:25.990 DEBUG Processed: layout/archive.ejs
14:40:25.990 DEBUG Processed: layout/index.ejs
14:40:25.990 DEBUG Processed: layout/post.ejs
14:40:25.990 DEBUG Processed: languages/en.yml
14:40:25.990 DEBUG Processed: languages/ja.yml
14:40:25.990 DEBUG Processed: languages/zh-CN.yml
14:40:26.084 DEBUG Processed: layout/_partial/article.ejs
14:40:26.084 DEBUG Processed: layout/_partial/ga.ejs
14:40:26.084 DEBUG Processed: layout/_partial/cards.ejs
14:40:26.084 DEBUG Processed: layout/_partial/footer.ejs
14:40:26.084 DEBUG Processed: layout/_partial/head.ejs
14:40:26.084 DEBUG Processed: layout/_partial/header.ejs
14:40:26.084 DEBUG Processed: layout/_partial/scripts.ejs
14:40:26.084 DEBUG Processed: layout/_partial/jumbotron.ejs
14:40:26.084 DEBUG Processed: layout/_partial/words.ejs
14:40:26.242 DEBUG Processed: _posts/de/testindlaeg-med-Icarus.md
14:40:26.242 DEBUG Processed: _posts/de/st-med-lang.md
14:40:26.242 DEBUG Processed: _posts/en/testindlaeg-med-Icarus.md
14:40:26.242 DEBUG Processed: _posts/da/ny-test.md
14:40:26.242 DEBUG Processed: _posts/en/st-med-lang.md
14:40:26.242 DEBUG Processed: _posts/da/hello-world.md
14:40:26.242 DEBUG Processed: _posts/en/test-med-kategori.md
14:40:26.939 DEBUG Generator: page
14:40:26.939 DEBUG Generator: post
14:40:26.939 DEBUG Generator: archive
14:40:26.939 DEBUG Generator: category
14:40:26.939 DEBUG Generator: index-i18n
14:40:26.939 DEBUG Generator: tag
14:40:26.939 DEBUG Generator: index
14:40:26.939 DEBUG Generator: asset
14:40:26.955 INFO  Files loaded in 2.36 s
14:40:27.019 DEBUG Rendering post: undefined/2016/08/03/de/st-med-lang/index.html
14:40:27.035 DEBUG Rendering post: undefined/2016/08/03/en/st-med-lang/index.html
14:40:27.051 DEBUG Rendering post: undefined/2016/08/03/en/test-med-kategori/index.html
14:40:27.051 DEBUG Rendering post: undefined/2016/08/03/de/testindlaeg-med-Icarus/index.html
14:40:27.066 DEBUG Rendering post: undefined/2016/08/03/en/testindlaeg-med-Icarus/index.html
14:40:27.066 DEBUG Rendering post: undefined/2016/08/02/da/ny-test/index.html
14:40:27.066 DEBUG Rendering post: undefined/2016/08/02/da/hello-world/index.html
14:40:27.066 DEBUG Rendering archive: categories/Kategori1/index.html
14:40:27.066 DEBUG Rendering archive: categories/Kategori1/Kategori2/index.html
14:40:27.082 DEBUG Rendering archive: categories/Kategori1/Kategori2/Kategori3/index.html
14:40:27.082 DEBUG Rendering archive: tags/Et-tag/index.html
14:40:27.082 DEBUG Rendering index: index.html
Unhandled rejection TypeError: D:\vscode\hexo\odense\themes\wiki-i18n\layout\post.ejs:5
    3| <%- partial('_partial/head') %>
    4|   <body>
 >> 5|   <%- partial('_partial/header') %>
    6|   <%- partial('_partial/article') %>
    7|   <%- partial('_partial/footer') %>
    8|   <%- partial('_partial/scripts') %>

D:\vscode\hexo\odense\themes\wiki-i18n\layout\_partial\header.ejs:24
    22|           Choose a language
    23|         <% } else { %>
 >> 24|           <%= site.data.languages[page.lang] %>
    25|         <% } %>
    26|         </label>
    27|         <select id="header-lang-select" class="header-lang-select">

***** THE FOLLOWING LINES ARE REPEATED ABOUT 10 TIMES: *****

Cannot read property 'en' of undefined
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:1520)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:2821)
    at D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:255:15
    at _compiledSync (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:122:20)
    at View.renderSync (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:50:21)
    at Object.partial (D:\vscode\hexo\Odense\node_modules\hexo\lib\plugins\helper\partial.js:42:17)
    at Object.wrapper (D:\vscode\hexo\Odense\node_modules\lodash\lodash.js:4597:19)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:126)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:361)
    at D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:255:15
    at _compiled (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:127:30)
    at View.render (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:29:15)
    at D:\vscode\hexo\Odense\node_modules\hexo\lib\hexo\index.js:387:25
    at tryCatcher (D:\vscode\hexo\Odense\node_modules\bluebird\js\release\util.js:16:23)
    at D:\vscode\hexo\Odense\node_modules\bluebird\js\release\method.js:15:34
    at RouteStream._read (D:\vscode\hexo\Odense\node_modules\hexo\lib\hexo\router.js:134:3)
    at RouteStream.Readable.read (_stream_readable.js:349:10)
    at resume_ (_stream_readable.js:738:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
Unhandled rejection TypeError: D:\vscode\hexo\odense\themes\wiki-i18n\layout\post.ejs:5
    3| <%- partial('_partial/head') %>
    4|   <body>
 >> 5|   <%- partial('_partial/header') %>
    6|   <%- partial('_partial/article') %>
    7|   <%- partial('_partial/footer') %>
    8|   <%- partial('_partial/scripts') %>

D:\vscode\hexo\odense\themes\wiki-i18n\layout\_partial\header.ejs:24
    22|           Choose a language
    23|         <% } else { %>
 >> 24|           <%= site.data.languages[page.lang] %>
    25|         <% } %>
    26|         </label>
    27|         <select id="header-lang-select" class="header-lang-select">

***** END OF REPEATING LINES *****

Jan@JLKM1 MINGW64 /d/vscode/hexo/odense
$ hexo server
INFO  Start processing
INFO  Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.
Unhandled rejection TypeError: D:\vscode\hexo\odense\themes\wiki-i18n\layout\index.ejs:5
    3| <%- partial('_partial/head') %>
    4|   <body>
 >> 5|   <%- partial('_partial/header') %>
    6|   <%- partial('_partial/jumbotron') %>
    7|   <%- partial('_partial/cards', {
    8|     title: __('new'),

D:\vscode\hexo\odense\themes\wiki-i18n\layout\_partial\header.ejs:31
    29|           <option disabled selected value class="hidden">Choose a language</option>
    30|           <% get_langs().forEach(lang => { %>
 >> 31|             <option value="<%= lang %>" data-href="<%= switch_lang(lang) %>"><%= site.data.languages[lang] %></option>
    32|           <% }) %>
    33|         <% } else { %>
    34|           <% get_langs().forEach(lang => { %>

Cannot read property 'en' of undefined
    at get_langs.forEach.lang (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:2081)
    at Array.forEach (native)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:1862)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:2821)
    at D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:255:15
    at _compiledSync (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:122:20)
    at View.renderSync (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:50:21)
    at Object.partial (D:\vscode\hexo\Odense\node_modules\hexo\lib\plugins\helper\partial.js:42:17)
    at Object.wrapper (D:\vscode\hexo\Odense\node_modules\lodash\lodash.js:4597:19)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:126)
    at eval (eval at <anonymous> (D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:33:157)
    at D:\vscode\hexo\Odense\node_modules\ejs\lib\ejs.js:255:15
    at _compiled (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:127:30)
    at View.render (D:\vscode\hexo\Odense\node_modules\hexo\lib\theme\view.js:29:15)
    at D:\vscode\hexo\Odense\node_modules\hexo\lib\hexo\index.js:387:25
    at tryCatcher (D:\vscode\hexo\Odense\node_modules\bluebird\js\release\util.js:16:23)
    at D:\vscode\hexo\Odense\node_modules\bluebird\js\release\method.js:15:34
    at RouteStream._read (D:\vscode\hexo\Odense\node_modules\hexo\lib\hexo\router.js:134:3)
    at RouteStream.Readable.read (_stream_readable.js:349:10)
    at resume_ (_stream_readable.js:738:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
JLKM commented 8 years ago

Access to language-settings in _config.yml

After considerable struggle I've managed to generate and serve markdown-files with Hexo through hexo-theme-wiki-i18n.

Quite awesome with the language filters on the files. This is really a nice feature, that many people can make good use of.

But to make this happen, I had to replace language settings with a fixed value in seven lines (from three files) below.

wiki-i18n\scripts\hexo-helpers.js:

function getLangs() {
  // return this.config.language.filter(lang => lang !== 'default');
Line 12 =>  return ['da', 'en', 'de'];
  // return ['da'];
}

hexo-theme-wiki-i18n/layout/_partial/header.ejs:

Line 24 =>          <%= site.data.languages[page.lang] %>
        <% } %>
        </label>
        <select id="header-lang-select" class="header-lang-select">
        <% if (is_root()) { %>
          <option disabled selected value class="hidden">Choose a language</option>
          <% get_langs().forEach(lang => { %>
 Line 31 =>           <option value="<%= lang %>" data-href="<%= switch_lang(lang) %>"><%= site.data.languages[lang] %></option>
          <% }) %>
        <% } else { %>
          <% get_langs().forEach(lang => { %>
            <option
              value="<%= lang %>"
              <%= lang === page.lang ? 'selected' : ''%>
              data-href="<%= switch_lang(lang) %>"
            >
Line 40 =>              <%= site.data.languages[lang] %>

hexo-theme-wiki-i18n/layout/_partial/jumbotron.ejs:

Line 6 =>      <a class="jumbotron-create-link" target="_blank" href="https://github.com/xcatliu/js-index/new/master/source/_posts/<%= page.lang %>"><%= __('jumbotron.create') %></a>
    </div>
    <div class="jumbotron-languages">
      <% if (is_root()) { %>
        <span class="jumbotron-language-strong">Choose a language:</span>
      <% } %>
      <% get_langs().forEach(lang => { %>
        <% if (lang === page.lang && !is_root()) { %>
Line 14 =>          <span class="jumbotron-language-strong"><%= site.data.languages[lang] %></span>
        <% } else { %>
Line 16 =>          <a class="jumbotron-language-link" href="<%= url_for(lang) %>"><%= site.data.languages[lang] %></a>

It seems, that I have no access to the language settings in main-Hexo _config.yml.

And I'm not able to locate this file, which may contain some of the language-functions needed.

Others mention this plugin recommended for language-operations.

Any suggestions how to get ones hands on both the collection of languages in use and the actual language, that the user has chosen.