hexo server

我的hexo能成功部署 且大开链接也有效果 只是每次在hexo s 的时候会有瑕疵,有如下错误:

➜  blog  hexo s
INFO  Start processing
ERROR Process failed: layout/.DS_Store
TypeError: Cannot read property 'compile' of undefined
    at View._precompile (/Users/idisfkj/blog/node_modules/hexo/lib/theme/view.js:104:22)
    at View (/Users/idisfkj/blog/node_modules/hexo/lib/theme/view.js:13:8)
    at new Theme._View.View (/Users/idisfkj/blog/node_modules/hexo/lib/theme/index.js:37:10)
    at Theme.setView (/Users/idisfkj/blog/node_modules/hexo/lib/theme/index.js:71:20)
    at /Users/idisfkj/blog/node_modules/hexo/lib/theme/processors/view.js:14:14
    at tryCatcher (/Users/idisfkj/blog/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:503:31)
    at Promise._settlePromise (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:684:18)
    at Promise._fulfill (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:629:18)
    at Promise._resolveCallback (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:424:57)
    at Promise._settlePromiseFromHandler (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:515:17)
    at Promise._settlePromise (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:684:18)
    at Promise._fulfill (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:629:18)
    at /Users/idisfkj/blog/node_modules/bluebird/js/release/nodeback.js:42:21
    at /Users/idisfkj/blog/node_modules/graceful-fs/graceful-fs.js:78:16
    at tryToString (fs.js:414:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:401:12)
ERROR Process failed: layout/_partial/.DS_Store
TypeError: Cannot read property 'compile' of undefined
    at View._precompile (/Users/idisfkj/blog/node_modules/hexo/lib/theme/view.js:104:22)
    at View (/Users/idisfkj/blog/node_modules/hexo/lib/theme/view.js:13:8)
    at new Theme._View.View (/Users/idisfkj/blog/node_modules/hexo/lib/theme/index.js:37:10)
    at Theme.setView (/Users/idisfkj/blog/node_modules/hexo/lib/theme/index.js:71:20)
    at /Users/idisfkj/blog/node_modules/hexo/lib/theme/processors/view.js:14:14
    at tryCatcher (/Users/idisfkj/blog/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:503:31)
    at Promise._settlePromise (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:684:18)
    at Promise._fulfill (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:629:18)
    at Promise._resolveCallback (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:424:57)
    at Promise._settlePromiseFromHandler (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:515:17)
    at Promise._settlePromise (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:684:18)
    at Promise._fulfill (/Users/idisfkj/blog/node_modules/bluebird/js/release/promise.js:629:18)
    at /Users/idisfkj/blog/node_modules/bluebird/js/release/nodeback.js:42:21
    at /Users/idisfkj/blog/node_modules/graceful-fs/graceful-fs.js:78:16
    at tryToString (fs.js:414:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:401:12)
INFO  Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.

虽然能成功 但每次看到这个心里就不爽,(强迫症)
有碰到这种情况的兄弟吗? 如何解决。

阅读 5.5k
5 个回答

把 .DS_Store 删了试试……

有可能配置文件有问题,但我的遇到的情况跟你这个不大一样。我是hexo s启动之后,会报各种各样的错误,但不影响使用。

你用的主题的js有报错

新手上路,请多包涵

cd 进到你使用的theme对应的目录,再进到layout/和layout/_partial/下.
分别执行rm .DS_Store

这个报错貌似不会影响到使用,但还是挺恶心的。

目录切到你所用那个主题的主目录的样式文件目录,以我的为例

cd themes/maupassant/layout

ls -al 列出所有信息包裹隐藏文件

rm -fr .DS_Store 删除

再执行 hexo generate就没有报错了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏