Giter Site home page Giter Site logo

报错 about hexo-theme-minos HOT 7 CLOSED

ppoffice avatar ppoffice commented on May 10, 2024
报错

from hexo-theme-minos.

Comments (7)

poying avatar poying commented on May 10, 2024 1

@ppoffice 補充

https://github.com/hexojs/hexo/blob/1b418b192d99202cbcda4e507c44af1a32dbc643/lib/hexo/index.js#L228

script = `(function(exports, require, module, __filename, __dirname, hexo){${script}});`;

hexo 變數在 Hexo 主程式定義的方式本就是 local 變數,並非 global,所已會遇到這個問題還滿合理的。不清楚為什麼其他人沒遇到這個問題。

from hexo-theme-minos.

lijunnba2009 avatar lijunnba2009 commented on May 10, 2024

环境:
hexo: 3.7.1
hexo-cli: 1.1.0
os: Windows_NT 10.0.17134 win32 x64
http_parser: 2.7.0
node: 6.5.0
v8: 5.1.281.81
uv: 1.9.1
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 57.1
modules: 48
openssl: 1.0.2h

from hexo-theme-minos.

ppoffice avatar ppoffice commented on May 10, 2024

@lijunnba2009 请尝试升级下node的版本。如果问题仍然存在,请帖一下博客的源代码地址,这样我可以调试一下。

from hexo-theme-minos.

lijunnba2009 avatar lijunnba2009 commented on May 10, 2024

@ppoffice 尝试把node切到 8.11.3和6.9.5,仍报原先的错误,我的博客源码地址 https://github.com/lijunnba2009/leeblog

from hexo-theme-minos.

ppoffice avatar ppoffice commented on May 10, 2024

@lijunnba2009 我clone了你的博客并进行了测试,并没有发现你所说的问题。请首先确保安装了hexo-renderer-sass,并且使用hexo clean清除缓存,然后使用hexo g或者hexo s是否能正常生成博客文件。

$ hexo -v
hexo: 3.7.1
hexo-cli: 1.1.0
os: Windows_NT 10.0.17134 win32 x64
http_parser: 2.8.0
node: 8.11.2
v8: 6.2.414.54
uv: 1.19.1
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.29.0
napi: 3
openssl: 1.0.2o
icu: 60.1
unicode: 10.0
cldr: 32.0
tz: 2017c

from hexo-theme-minos.

poying avatar poying commented on May 10, 2024

@ppoffice 遇到同樣的問題

問題在於 10_i18n.js,他總共被執行三次,其中兩次分別由 01_check.js99_content.js 執行,在這種情況下 10_i18n.js 得不到 global 的 hexo 變數。不確定問題發生在哪,但可以簡單粗暴地解決。

解法:在 01_check.js99_content.js 兩個檔案第一行加上 global.hexo = hexo

from hexo-theme-minos.

ppoffice avatar ppoffice commented on May 10, 2024

@poying 非常感谢您的提醒。经过排查,我发现这个问题与hexo-renderer-sass和hexo的scripts引用过程中的参数传递有关。

首先,导致你和上面题主报错的原因在于被require10_i18n.js中hexo变量确实不存在,而由于这个文件是由其他scripts引用的,引用者的本地hexo变量并没有借着require('./10_i18n')传入被引用的文件中,导致出错。

另外,其他人没有出错的原因在于他们安装的hexo-renderer-sass的版本较低。在其v0.3.1v0.3.2版本中,hexo变量被直接暴露给global,所以会使require('./10_i18n')中存在hexo,掩盖了这个bug
https://github.com/knksmith57/hexo-renderer-sass/blob/0.3.1/index.js#L6

from hexo-theme-minos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.