Hexo-theme-next: Unhandled rejection TypeError: path.substring is not a function

Created on 15 Oct 2017  ·  8Comments  ·  Source: iissnan/hexo-theme-next


Expected behavior

hexo g 正常

Actual behavior

hexo 失败

Steps to reproduce the behavior

  1. 新建一个 hexo 项目 hexo init demo && cd demo
  2. git clone https://github.com/iissnan/hexo-theme-next themes/next
    ...
    正常的操作方式就会出现错误
Unhandled rejection TypeError: path.substring is not a function
    at Object.urlForHelper (/Users/jingwenzheng/Desktop/demo/node_modules/hexo/lib/plugins/helper/url_for.js:9:31)
    at wrapper (/Users/jingwenzheng/Desktop/demo/node_modules/lodash/lodash.js:4968:19)
    at Object.eval [as tpl] (eval at <anonymous> (/Users/jingwenzheng/Desktop/demo/node_modules/swig/lib/swig.js:498:13), <anonymous>:125:119)
    at compiled (/Users/jingwenzheng/Desktop/demo/node_modules/swig/lib/swig.js:619:18)
    at Object.eval [as tpl] (eval at <anonymous> (/Users/jingwenzheng/Desktop/demo/node_modules/swig/lib/swig.js:498:13), <anonymous>:807:135)
    at compiled (/Users/jingwenzheng/Desktop/demo/node_modules/swig/lib/swig.js:619:18)
    at _compiled (/Users/jingwenzheng/Desktop/demo/node_modules/hexo/lib/theme/view.js:127:30)
    at View.render (/Users/jingwenzheng/Desktop/demo/node_modules/hexo/lib/theme/view.js:29:15)
    at /Users/jingwenzheng/Desktop/demo/node_modules/hexo/lib/hexo/index.js:390:25
    at tryCatcher (/Users/jingwenzheng/Desktop/demo/node_modules/bluebird/js/release/util.js:16:23)
    at /Users/jingwenzheng/Desktop/demo/node_modules/bluebird/js/release/method.js:15:34
    at RouteStream._read (/Users/jingwenzheng/Desktop/demo/node_modules/hexo/lib/hexo/router.js:134:3)
    at RouteStream.Readable.read (_stream_readable.js:336:10)
    at resume_ (_stream_readable.js:726:12)
    at _combinedTickCallback (node.js:377:13)
    at process._tickCallback (node.js:401:11)
  • Link to demo site with this issue: null
  • Link(s) to source code or any usefull link(s): null

Hexo Information

hexo: 3.3.9
hexo-cli: 1.0.1
os: Darwin 16.7.0 darwin x64
http_parser: 2.6.2
node: 5.8.0
v8: 4.6.85.31
uv: 1.8.0
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 56.1
modules: 47
openssl: 1.0.2g

当前的 hexo-theme-next 版本 v5.1.3

NexT Information

NexT Version:

  • [ ] Latest Master branch.
  • [x] Latest Release version.
  • [ ] Old version -

NexT Scheme:

  • [x] All schemes
  • [ ] Muse
  • [ ] Mist
  • [ ] Pisces
  • [ ] Gemini

Other Information

调试发现问题出在
````

try
{
if (path[0] === '#' || path.substring(0, 2) === '//') {
return path;
}
}
catch (e)
{

console.log(typeof path);
console.log(path.constructor.name);
console.log(path);

console.log(e.message);
console.log(e.description)
throw new Error(10,"asdasdasd")
}
````

本来 Path 应该为字符串的但是却出现了

Function function function small() { [native code] } path.substring is not a function TypeError

Most helpful comment

My reason is that I used the old version of thenext configuration file

All 8 comments

???

Try to check latest master branch. Issue still exists?

"before_script": [ "git config --global user.name \"aimobier\"", "git config --global user.email \"[email protected]\"", "sed -i'' \"[email protected]:${UName}/${PName}.git~https://${github}:[email protected]/${UName}/${PName}.git~\" _config.yml", "git clone https://github.com/iissnan/hexo-theme-next themes/next", "ls", "pwd", "cp -rf source/themes_config.yml themes/next/_config.yml", "cp -rf source/404.html themes/next/source/404.html" ],

yes,issue still exists

  1. Could you please provide the following information?

    • Node.js and NPM version ($node -v && npm -v)?
    • Hexo version ($hexo -v)?
    • Your site package dependencies ($cat package.json)?
  2. Please, try to reproduce this behavior with any default Hexo theme (light / landscape).
    If behavior will same, it's not NexT theme bug; close this issue and create same issue in Hexo repositories: hexo-renderer-marked or hexo root engine will at most best choises.

I have also met this issue, if I change the theme to other theme, hexo s -g runs fine, but if I use theme NexT, error messages occur

If I completely delete next directory in my local machine and git clone the repo again, the error message will disappear. I do not know why.

@jdhao need mo info.

My reason is that I used the old version of thenext configuration file

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keltoy picture keltoy  ·  3Comments

LionWY picture LionWY  ·  3Comments

bingstyle picture bingstyle  ·  3Comments

dev-fancyluo picture dev-fancyluo  ·  3Comments

blueyi picture blueyi  ·  5Comments