SyntaxError:意外的POST_IF错误

options = { host : 'http://localhost:8080' port : 8080 path : '.frameset?__report=stock_report.rptdesign' } http.get(options , (res) -> console.log "Got response : " + res.statusCode res.on 'data' , (chunk) -> console.log "BODY : " + chunk ).on 'error' , (e) -> console.log "Got error : " + e.message 

我想在nodejs中发送tomcat服务器的http请求。 但意外的POST_IF错误发生。 为什么?

如果您将缩进与空格结合使用或使用错误的缩进,则coffeescript会给出意外的POST_IF错误。 解决scheme:

– 确保您只使用制表符或空格进行缩进
– 如果你在Intellij Idea,Code – > Reformat Code(试图正确放置缩进)