hexo icon indicating copy to clipboard operation
hexo copied to clipboard

Possibly unhanded TypeError: Cannot call method 'concat' of undefined

Open celsomiranda opened this issue 11 years ago • 10 comments

I'm getting this error when running hexo generate or hexo server

The error references the following code: https://github.com/hexojs/hexo/blob/dev/lib/hexo/index.js#L305

My system:

$ hexo version

hexo: 3.0.0-beta.2
os: Windows_NT 6.2.9200 win32 x64
http_parser: 1.0
node: 0.10.35
v8: 3.14.5.9
ares: 1.9.0-DEV
uv: 0.10.30
zlib: 1.2.8
modules: 11
openssl: 1.0.1j

celsomiranda avatar Jan 19 '15 23:01 celsomiranda

Could you post the full error message?

tommy351 avatar Jan 20 '15 02:01 tommy351

Can't reproduce the error. But it does give me this result:

C:\gh\hexotest> hexo clean --debug
12:12:24.084 DEBUG Hexo version: 3.0.0-beta.2
12:12:24.099 DEBUG Working directory: C:\gh\hexotest\
12:12:25.199 DEBUG Config loaded: C:\gh\hexotest\_config.yml
12:12:25.277 DEBUG Script loaded: themes\landscape\scripts\fancybox.js
12:12:25.293 DEBUG Plugin loaded: hexo-generator-archive
12:12:25.329 DEBUG Plugin loaded: hexo-generator-category
12:12:25.349 DEBUG Plugin loaded: hexo-generator-index
12:12:25.364 DEBUG Plugin loaded: hexo-generator-tag
12:12:25.442 DEBUG Plugin loaded: hexo-renderer-ejs
12:12:26.168 DEBUG Plugin loaded: hexo-renderer-marked
12:12:27.038 DEBUG Plugin loaded: hexo-renderer-stylus
12:12:27.694 DEBUG Plugin loaded: hexo-server
12:12:27.694 INFO  Deleted database.
12:12:27.710 DEBUG About to exit
12:12:27.710 FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
undefined
12:12:27.710 DEBUG Database saved
C:\gh\hexotest>

celsomiranda avatar Jan 20 '15 12:01 celsomiranda

C:\OpenSources\cache\hexo3.0>hexo clean --debug
16:04:16.041 DEBUG Hexo version: 3.0.0-beta.2
16:04:16.047 DEBUG Working directory: C:\OpenSources\cache\hexo3.0\
16:04:16.356 DEBUG Config loaded: C:\OpenSources\cache\hexo3.0\_config.yml
16:04:16.364 DEBUG Script loaded: themes\landscape\scripts\fancybox.js
16:04:16.379 DEBUG Plugin loaded: hexo-generator-category
16:04:16.391 DEBUG Plugin loaded: hexo-generator-index
16:04:16.400 DEBUG Plugin loaded: hexo-generator-tag
16:04:16.420 DEBUG Plugin loaded: hexo-renderer-ejs
16:04:16.633 DEBUG Plugin loaded: hexo-renderer-stylus
16:04:16.664 ERROR Plugin load failed: hexo-renderer-marked
TypeError: Cannot read property 'highlight' of undefined
    at C:\OpenSources\cache\hexo3.0\node_modules\hexo-renderer-marked\index.js:4:19

notedown avatar Jan 22 '15 08:01 notedown

@liyouhai Your problem is not related to this issue. See #1003

tommy351 avatar Jan 22 '15 08:01 tommy351

I've installed the new beta and it's throwing the same error now.

FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
TypeError: Cannot call method 'concat' of undefined
    at C:\Users\celso_000\AppData\Roaming\npm\node_modules\hexo\lib\hexo\index.js:311:30
    at tryCatcher (C:\Users\celso_000\AppData\Roaming\npm\node_modules\hexo\node_modules\bluebird\js\main\util.js:24:31)
    at Promise._settlePromiseFromHandler (C:\Users\celso_000\AppData\Roaming\npm\node_modules\hexo\node_modules\bluebird\js\main\promise.js:582:31)
    at Promise._settlePromiseAt (C:\Users\celso_000\AppData\Roaming\npm\node_modules\hexo\node_modules\bluebird\js\main\promise.js:727:18)
    at Promise._settlePromiseAtPostResolution (C:\Users\celso_000\AppData\Roaming\npm\node_modules\hexo\node_modules\bluebird\js\main\promise.js:310:10)
    at Async._drainQueue (C:\Users\celso_000\AppData\Roaming\npm\node_modules\hexo\node_modules\bluebird\js\main\async.js:84:12)
    at Async._drainQueues (C:\Users\celso_000\AppData\Roaming\npm\node_modules\hexo\node_modules\bluebird\js\main\async.js:89:10)
    at Async.drainQueues (C:\Users\celso_000\AppData\Roaming\npm\node_modules\hexo\node_modules\bluebird\js\main\async.js:14:14)
    at process._tickCallback (node.js:442:13)

Result of $ hexo version:

hexo: 3.0.0-beta.3
os: Windows_NT 6.2.9200 win32 x64
http_parser: 1.0
node: 0.10.35
v8: 3.14.5.9
ares: 1.9.0-DEV
uv: 0.10.30
zlib: 1.2.8
modules: 11
openssl: 1.0.1j

Contents of package.json:

{
  "name": "hexo-site",
  "version": "3.0.0-beta.3",
  "private": true,
  "dependencies": {
    "hexo-deployer-git": "0.0.2",
    "hexo-generator-archive": "0.0.2",
    "hexo-generator-category": "0.0.3",
    "hexo-generator-feed": "^1.0.0",
    "hexo-generator-index": "0.0.2",
    "hexo-generator-sitemap": "^1.0.0",
    "hexo-generator-tag": "0.0.3",
    "hexo-renderer-ejs": "^0.1.0",
    "hexo-renderer-jade": "*",
    "hexo-renderer-marked": "^0.2.3",
    "hexo-renderer-stylus": "^0.2.1",
    "hexo-server": "0.0.4"
  }
}

celsomiranda avatar Jan 23 '15 16:01 celsomiranda

I've tried a vanilla install on a test dir and I don't get the error, so I'm thinking it's maybe related to the jade renderer.

celsomiranda avatar Jan 23 '15 16:01 celsomiranda

It's weird. I have almost same package.json but Hexo can run without any errors. I'll try to investigate this problem.

{
  "name": "hexo-site",
  "version": "3.0.0-beta.3",
  "private": true,
  "dependencies": {
    "hexo-generator-archive": "0.0.2",
    "hexo-generator-feed": "^1.0.0",
    "hexo-generator-index": "0.0.2",
    "hexo-generator-sitemap": "^1.0.0",
    "hexo-generator-tag": "0.0.3",
    "hexo-renderer-ejs": "^0.1.0",
    "hexo-renderer-marked": "^0.2.3",
    "hexo-renderer-stylus": "^0.2.1",
    "hexo-server": "0.0.4"
  }
}

tommy351 avatar Jan 23 '15 17:01 tommy351

After a lot of debugging, I found out what happened. The error happens when you have an empty _posts folder inside of the source folder.

I've tried many combinations, but creating an *.md file inside that folder made the error go away.

celsomiranda avatar Jan 24 '15 00:01 celsomiranda

Thanks. I'll fix it.

tommy351 avatar Jan 24 '15 02:01 tommy351

Thanks.

A dom, 25/01/2015, 06:21, Tommy Chen [email protected] escreveu:

Closed #1000 https://github.com/hexojs/hexo/issues/1000 via f1d896f https://github.com/hexojs/hexo/commit/f1d896f71333b1158c1e0e996fcb42fdac6ddd92 .

— Reply to this email directly or view it on GitHub https://github.com/hexojs/hexo/issues/1000#event-224264680.

celsomiranda avatar Jan 25 '15 17:01 celsomiranda