tufu9441 / maupassant-hexo

A simple Hexo theme forked from icylogic.
https://www.haomwei.com
MIT License
2.64k stars 669 forks source link

安装完主题,本地预览后报错,请问是什么原因呢? #477

Closed ColarXu closed 4 years ago

ColarXu commented 4 years ago

不会编程,实在头痛。

返回的代码如下:

INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.

Unhandled rejection TypeError: /Users/colar/blog/themes/maupassant/layout/_partial/after_footer.pug:35 33| script(type='text/javascript', src=url_for(theme.js) + '/search.js' + '?v=' + theme.version) 34| script.

35| var search_path = '#{config.search.path}'; 36| if (search_path.length == 0) { 37| search_path = 'search.xml'; 38| }

Cannot read property 'path' of undefined at eval (eval at wrap (/Users/colar/blog/node_modules/_pug-runtime@2.0.5@pug-runtime/wrap.js:6:10), :1264:71) at template (eval at wrap (/Users/colar/blog/node_modules/_pug-runtime@2.0.5@pug-runtime/wrap.js:6:10), :1350:268) at viewFn._compiled (/Users/colar/blog/node_modules/hexo/lib/theme/view.js:136:48) at viewFn.View.render (/Users/colar/blog/node_modules/hexo/lib/theme/view.js:41:15) at /Users/colar/blog/node_modules/hexo/lib/hexo/index.js:61:21 at tryCatcher (/Users/colar/blog/node_modules/bluebird/js/release/util.js:16:23) at /Users/colar/blog/node_modules/bluebird/js/release/method.js:15:34 at RouteStream._read (/Users/colar/blog/node_modules/hexo/lib/hexo/router.js:126:3) at RouteStream.Readable.read (_streamreadable.js:478:10) at resume (_stream_readable.js:965:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)

0x2CA commented 4 years ago

self_search - A jQuery-based local search engine, with the dependency on the plugin hexo-generator-search

ColarXu commented 4 years ago

hexo-generator-search

尝试安装了插件,也尝试把 self_search 设置为 false,但每次重新生成页面,浏览器都显示:

extends base block title if config.subtitle title= config.title + ' | ' + config.subtitle else title= config.title block content for post in page.posts.toArray() .post h1.post-title include _partial/helpers.pug a(href=url_for(post.path)) +title(post) .post-meta= post.date.format(config.date_format) if theme.disqus a.disqus-comment-count(data-disqus-identifier=post.path, href=url_for(post.path) + '#disqus_thread') if theme.changyan a.ds-thread-count(href=url_for(post.path) + '#SOHUCS') span.cy_cmt_count(id='sourceId::' + post.date.valueOf() style='margin: 0 3px 0 1px;') 0 span= ' ' + __('Comment') if post.description .post-content != post.description else if post.excerpt .post-content != post.excerpt else if post.content - var br = 0 - for (var i = 0; i < 5; ++i) { - br = post.content.indexOf('\n',br+1) if br<0 - break if br >150 - break - } if br < 0 .post-content != post.content else .post-content != post.content.substring(0, br) p(class='readmore') a(href=url_for(post.path))= __('Readmore') include _partial/paginator.pug if theme.disqus script(id='dsq-count-scr', src='//'+ theme.disqus + '.disqus.com/count.js', async) if theme.changyan script#cy_cmt_num(src='https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=' + theme.changyan, async) if config.mathjax include _partial/mathjax.pug if config.mathjax2 include _partial/mathjax2.pug

0x2CA commented 4 years ago

看不出什么问题,你确定安装好了?

$ npm install hexo-renderer-pug --save
$ npm install hexo-renderer-sass --save

指南

ColarXu commented 4 years ago

@0x2CA 都装了,我刚又装了一次。发现每一次都有红色 deprecate 的提示,跟它们有关系吗?

deprecate hexo-renderer-pug@1.0.0 › pug@2.0.4 › pug-code-gen@2.0.2 › constantinople@3.1.2 › babel-types@6.26.0 › babel-runtime@6.26.0 › core-js@^2.4.0 core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

deprecate hexo-renderer-sass@0.4.0 › hexo@4.2.0 › hexo-log@1.0.0 › hexo-bunyan@2.0.0 › mv@2.1.1 › mkdirp@~0.5.1 Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) Recently updated (since 2020-03-18): 3 packages (detail see file /Users/colar/blog/node_modules/.recently_updates.txt)

ColarXu commented 4 years ago

我装了这个:hexo-renderer-jade,然后其他插件重装了一遍,现在好了~