hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.2k stars 4.82k forks source link

Cloud9 Issue: Cannot call method 'postformat' of null #775

Closed Azd325 closed 9 years ago

Azd325 commented 10 years ago

This output I get on a terminal in the cloud 9 ide if I try to generate or to serve the data.

Any ideas?

[error] TypeError: Cannot call method 'postformat' of null
TypeError: Cannot call method 'postformat' of null
    at Moment.extend.format (/home/ubuntu/.nvm/v0.10.26/lib/node_modules/hexo/node_modules/moment/moment.js:2129:38)
    at module.exports (/home/ubuntu/.nvm/v0.10.26/lib/node_modules/hexo/lib/plugins/filter/post_permalink.js:15:21)
    at /home/ubuntu/.nvm/v0.10.26/lib/node_modules/hexo/lib/extend/filter.js:141:25
    at b (domain.js:183:18)
    at Domain.run (domain.js:123:23)
    at /home/ubuntu/.nvm/v0.10.26/lib/node_modules/hexo/lib/extend/filter.js:140:9
    at Array.forEach (native)
    at Filter.apply (/home/ubuntu/.nvm/v0.10.26/lib/node_modules/hexo/lib/extend/filter.js:137:10)
    at Object.Post.virtual.src (/home/ubuntu/.nvm/v0.10.26/lib/node_modules/hexo/lib/model/schema.js:39:29)
    at Model._applyGetter (/home/ubuntu/.nvm/v0.10.26/lib/node_modules/hexo/node_modules/warehouse/lib/model.js:240:24)
tommy351 commented 10 years ago

It may be a bug. I'll check it later.

Xuanwo commented 10 years ago

I use the C9, too. And everything fine, so I don't think it's a bug of Hexo. Check the settings of your workplace, try to reinstall nvm and hexo. From my point of view, the C9 have install many ting OK, so we just need to install hexo install of install git or nvm or nodejs. And if problem doesn't fixed, try to create a new workplace, install hexo, and have a look. If any problem, please connect me by email, I'm intrested in C9 now.

Azd325 commented 10 years ago

.@tommy351 I think so too because if I started from scratch a new hexo blog on c9 I don't get this error

@Xuanwo What you set up in you '_config.yml' to serve the page?

Xuanwo commented 10 years ago

@Azd325 What's your mean to serve the page? I did nothing special to adapt the C9 server, just use as my PC.

Azd325 commented 10 years ago

@Xuanwo Ok. I use the online c9 ide on https://c9.io/ The you have to set the IP and the PORT over the process.env object

Xuanwo commented 10 years ago

@Azd325 Sorry, I can't understand what your mean. Do you mean without deploy to github, just use hexo by loaclhost in c9? eee, I don't know what will happen, sorry.

Azd325 commented 10 years ago

@Xuanwo https://docs.c9.io/writing_nodejs_hello_world.html#a-simple-nodejs-http-server That I mean

I want to run this blog for dev purpose in the cloud

Xuanwo commented 10 years ago

@Azd325 I got it. post may be 4000 and ip may be 127.0.0.1, it doesn't work?

Azd325 commented 10 years ago

@Xuanwo OK I got it to run now. This are my settings in my config.yml.

port: 8080
server_ip: 0.0.0.0

but I still have this issue with my existing blog. That I get this error from my issue request.

Azd325 commented 10 years ago

@tommy351 May this can help you a bit more

azd325@hexoblog:/home/ubuntu/workspace (master) $ hexo generate

Deprecation warning: moment().lang() is deprecated. Use moment().localeData() instead.

[error] TypeError: Cannot call method 'postformat' of null
TypeError: Cannot call method 'postformat' of null
    at Moment.extend.format (/home/ubuntu/workspace/node_modules/hexo/node_modules/moment/moment.js:2129:38)
    at module.exports (/home/ubuntu/workspace/node_modules/hexo/lib/plugins/filter/post_permalink.js:15:21)
    at /home/ubuntu/workspace/node_modules/hexo/lib/extend/filter.js:141:25
    at b (domain.js:183:18)
    at Domain.run (domain.js:123:23)
    at /home/ubuntu/workspace/node_modules/hexo/lib/extend/filter.js:140:9
    at Array.forEach (native)
    at Filter.apply (/home/ubuntu/workspace/node_modules/hexo/lib/extend/filter.js:137:10)
    at Object.Post.virtual.src (/home/ubuntu/workspace/node_modules/hexo/lib/model/schema.js:39:29)
    at Model._applyGetter (/home/ubuntu/workspace/node_modules/hexo/node_modules/warehouse/lib/model.js:240:24)
Xuanwo commented 10 years ago

Deprecation warning: moment().lang() is deprecated. Use moment().localeData() instead. it looks like you need to update your hexo?

Azd325 commented 10 years ago

I'm already on the lastest version.

azd325@hexoblog:/home/ubuntu/workspace (master) $ hexo version
hexo: 2.8.2
os: Linux 3.14.12-c9 linux x64
http_parser: 1.0
node: 0.10.26
v8: 3.14.5.9
ares: 1.9.0-DEV
uv: 0.10.25
zlib: 1.2.3
modules: 11
openssl: 1.0.1e
Xuanwo commented 10 years ago

@Azd325 create a new workplace to have a test, if the problem reproduces, it must be a BUG If not, your settings may be wrong. by the way, what's your theme?

@tommy351 what's postformat?

Azd325 commented 10 years ago

@Xuanwo In a new workspace it works. I tested it already earlier this day with a new hexo blog.

Here my config.yml of my blog where I have my issue

{ title: 'Azd325@Github',
  subtitle: null,
  description: null,
  author: 'Tim Kleinschmidt',
  email: 'tim@email.com',
  language: 'English',
  url: 'http://azd325.github.io',
  root: '/',
  permalink: 'blog/:year/:month/:day/:path/',
  tag_dir: 'tags',
  archive_dir: 'archives',
  category_dir: 'categories',
  code_dir: 'downloads/code',
  permalink_defaults: null,
  source_dir: 'source',
  public_dir: 'public',
  new_post_name: ':title.md',
  default_layout: 'post',
  titlecase: false,
  external_link: true,
  filename_case: 0,
  render_drafts: false,
  post_asset_folder: false,
  relative_link: false,
  highlight: { enable: true, line_number: true, tab_replace: null },
  default_category: 'uncategorized',
  category_map: null,
  tag_map: null,
  archive: 2,
  category: 2,
  tag: 2,
  port: 8080,
  server_ip: '0.0.0.0',
  logger: false,
  logger_format: null,
  date_format: 'MMM D YYYY',
  time_format: 'H:mm:ss',
  per_page: 10,
  pagination_dir: 'page',
  disqus_shortname: 'Azd325',
  theme: 'light',
  exclude_generator: null,
  deploy: 
   { type: 'github',
     repo: 'git@github.com:Azd325/azd325.github.io.git',
     branch: 'master' },
  auto_spacing: false }
Azd325 commented 10 years ago

I search for 'postformat' in the github repo and I found this ticket #278 and I try for testing purpose to disable the language in my config and afterwards I was able to generate the data and to run the server.

@tommy351 I think this bug still exists in a different way. What you think?

iamtomcat commented 10 years ago

Hey I just ran into this bug as well and it was due to my language being set to "english" instead of the IETF code. Which looking above seems to be the same issue.

Azd325 commented 10 years ago

Thanks @iamtomcat, I changed my language settings to the IFTF code and it worked for me