Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: source.replace is not a function #1810

Closed
chenglongzjg opened this issue Mar 6, 2016 · 8 comments
Closed

TypeError: source.replace is not a function #1810

chenglongzjg opened this issue Mar 6, 2016 · 8 comments

Comments

@chenglongzjg
Copy link

Many thanks to you for creating hexo.
i hava a problem when use hexo.
when i ran "hexo deploy",the error appeared. i can visit http://localhost:4000 succeed. what will be the reason? thanks a lot. :)

TypeError: source.replace is not a function
    at Object.exports.parse (/Users/*/hexo/node_modules/swig/lib/parser.js:438:19)
    at parse (/Users/*/hexo/node_modules/swig/lib/swig.js:354:19)
    at Object.precompile (/Users/*/hexo/node_modules/swig/lib/swig.js:486:23)
    at Object.compile (/Users/*/hexo/node_modules/swig/lib/swig.js:606:16)
    at commitMessage (/Users/*/hexo/node_modules/hexo-deployer-git/lib/deployer.js:96:15)
    at Hexo.module.exports (/Users/*/hexo/node_modules/hexo-deployer-git/lib/deployer.js:22:17)
    at Hexo.tryCatcher (/Users/*/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Hexo.<anonymous> (/Users/*/hexo/node_modules/bluebird/js/release/method.js:15:34)
    at /Users/*/hexo/node_modules/hexo/lib/plugins/console/deploy.js:55:28
    at tryCatcher (/Users/*/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Object.gotValue (/Users/*/hexo/node_modules/bluebird/js/release/reduce.js:145:18)
    at Object.gotAccum (/Users/*/hexo/node_modules/bluebird/js/release/reduce.js:134:25)
    at Object.tryCatcher (/Users/*/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/*/hexo/node_modules/bluebird/js/release/promise.js:503:31)
    at Promise._settlePromise (/Users/*/hexo/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromiseCtx (/Users/*/hexo/node_modules/bluebird/js/release/promise.js:597:10)
    at Async._drainQueue (/Users/*/hexo/node_modules/bluebird/js/release/async.js:131:12)
    at Async._drainQueues (/Users/*/hexo/node_modules/bluebird/js/release/async.js:136:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/*/hexo/node_modules/bluebird/js/release/async.js:16:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
@leesei
Copy link
Member

leesei commented Mar 7, 2016

Did you tried npm update?
See #1805

@chenglongzjg
Copy link
Author

@leesei 你好,这个问题还是有的。。
之前没有 hexo deploy
今天尝试了一下 hexo deploy,还是原来的配方,还是原来的错。。
npm update过了。
#1805 也看过了。 也没用。
hexo deploy 回车后

INFO  Deploying: git
TypeError: source.replace is not a function
    at Object.exports.parse (/Users/*/hexo/node_modules/swig/lib/parser.js:438:19)
    at parse (/Users/*/hexo/node_modules/swig/lib/swig.js:354:19)
    at Object.precompile (/Users/*/hexo/node_modules/swig/lib/swig.js:486:23)
    at Object.compile (/Users/*/hexo/node_modules/swig/lib/swig.js:606:16)
    at commitMessage (/Users/*/hexo/node_modules/hexo-deployer-git/lib/deployer.js:96:15)
    at Hexo.module.exports (/Users/*/hexo/node_modules/hexo-deployer-git/lib/deployer.js:22:17)
    at Hexo.tryCatcher (/Users/*/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Hexo.<anonymous> (/Users/*/hexo/node_modules/bluebird/js/release/method.js:15:34)
    at /Users/*/hexo/node_modules/hexo/lib/plugins/console/deploy.js:55:28
    at tryCatcher (/Users/*/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Object.gotValue (/Users/*/hexo/node_modules/bluebird/js/release/reduce.js:145:18)
    at Object.gotAccum (/Users/*/hexo/node_modules/bluebird/js/release/reduce.js:134:25)
    at Object.tryCatcher (/Users/*/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/*/hexo/node_modules/bluebird/js/release/promise.js:503:31)
    at Promise._settlePromise (/Users/*/hexo/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromiseCtx (/Users/*/hexo/node_modules/bluebird/js/release/promise.js:597:10)
    at Async._drainQueue (/Users/*/hexo/node_modules/bluebird/js/release/async.js:131:12)
    at Async._drainQueues (/Users/*/hexo/node_modules/bluebird/js/release/async.js:136:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/*/hexo/node_modules/bluebird/js/release/async.js:16:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

npm ls | grep "hexo"

├─┬ hexo@3.2.0
│ ├─┬ hexo-cli@1.0.1
│ ├── hexo-front-matter@0.2.2
│ ├─┬ hexo-fs@0.1.5
│ ├─┬ hexo-i18n@0.2.1
│ ├─┬ hexo-log@0.1.2
│ ├─┬ hexo-util@0.5.3
├── hexo-deployer-git@0.1.0
├── hexo-deployer-heroku@0.1.0
├── hexo-deployer-openshift@0.1.0
├─┬ hexo-deployer-rsync@0.1.1
│ └─┬ hexo-util@0.1.7
├─┬ hexo-generator-archive@0.1.4
│ ├─┬ hexo-pagination@0.0.2
├─┬ hexo-generator-category@0.1.3
├─┬ hexo-generator-feed@1.1.0
├── hexo-generator-index@0.2.0
├── hexo-generator-sitemap@1.1.2
├── hexo-generator-tag@0.2.0
├─┬ hexo-renderer-ejs@0.2.0
├─┬ hexo-renderer-marked@0.2.10
├─┬ hexo-renderer-stylus@0.2.3
└─┬ hexo-server@0.2.0

hexo version

hexo: 3.2.0
hexo-cli: 1.0.1
os: Darwin 15.3.0 darwin x64
http_parser: 2.6.2
node: 5.7.1
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

@chenglongzjg
Copy link
Author

Hi。这个问题依然有。 看了相关的几个issue,update 过了, 重新新建目录也试过了 依然不顶用。

@chenglongzjg
Copy link
Author

chenglongzjg commented May 28, 2016

官网中关于 deployment git option 有这么一段

Customize commit message (Default to Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }})

所以在 _config.yml deploy中的 message 中 写了 {{ now('YYYY-MM-DD HH:mm:ss') }} 然后导致了错误
去掉就哦了

@Xuanwo
Copy link
Contributor

Xuanwo commented May 29, 2016

@chenglongzjg 你加上引号了么

@chenglongzjg
Copy link
Author

没有,直接{{}}了。文档是不是该清楚点。
message:如果为空,则默认为Site updated…

2016年5月29日星期日,漩涡 notifications@github.com 写道:

@chenglongzjg https://github.com/chenglongzjg 你加上引号了么


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1810 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AQzDL5PHvLKwQUB06f_SjY5HgtHUdsTKks5qGP4MgaJpZM4HqKPf
.

@ghost
Copy link

ghost commented Apr 12, 2017

{{ now('YYYY-MM-DD HH:mm:ss') }} you need to add quotation marks like
"{{ now('YYYY-MM-DD HH:mm:ss') }} "

@BoWang816
Copy link

message: "{{ now('YYYY-MM-DD HH:mm:ss') }}"

like this,it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants