0

我试图隐藏这行咖啡脚本:

app.use(express.static(path.join(__dirname, 'public')));

我只是将相同的内容复制并粘贴到咖啡脚本文件中,因为它看起来有效,但我遇到了一个问题:

error: unexpected CALL_END

C:/nodejs/coffee.cmd --map --compile test.coffee
test.coffee:20:1: error: reserved word "static"
static

任何帮助将不胜感激。

4

1 回答 1

1

Something seems wrong with your coffeescript install. I'm doing the same thing you're doing and it's all fine.

$ cat temp.coffee
app.use(express.static(path.join(__dirname, 'public')));

$ coffee -cm temp.coffee

$ cat temp.js
// Generated by CoffeeScript 1.6.2
(function() {
  app.use(express["static"](path.join(__dirname, 'public')));

}).call(this);

/*
//@ sourceMappingURL=temp.map
*/
$ cat temp.map 
{
  "version": 3,
  "file": "temp.js",
  "sourceRoot": "",
  "sources": [
    "temp.coffee"
  ],
  "names": [],
  "mappings": ";AAAA;CAAA,CAAA,CAAG,CAAwB,GAAZ,CAAA,CAAQ;CAAvB"
}

$ coffee -v
CoffeeScript version 1.6.2

$ which coffee
/usr/bin/coffee

Try following these steps and let me know what happens.

于 2013-08-17T22:49:03.353 回答