CoffeeScript和蛋糕

时间:2012-08-30 20:22:37

标签: macos coffeescript osx-mountain-lion

我使用npm install -g coffee-script在我的机器上安装了CoffeeScript。当我检查蛋糕版本时,我收到以下消息:

$ coffee -v
CoffeeScript version 1.3.3
[~]
$ cake -v
path.existsSync is now called `fs.existsSync`.

/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:108
    throw new Error("Cakefile not found in " + (process.cwd()));
          ^
Error: Cakefile not found in /Users/Phil
    at cakefileDirectory (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:108:11)
    at cakefileDirectory (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:106:14)
    at cakefileDirectory (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:106:14)
    at Object.exports.run (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:49:19)
    at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/coffee-script/bin/cake:7:38)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)

有谁知道如何解决这个问题?

3 个答案:

答案 0 :(得分:4)

这里有两个问题。

第一个是已知问题导致:

path.existsSync is now called `fs.existsSync`

您可以在此处找到有关此问题的更多信息: https://github.com/jashkenas/coffee-script/pull/2411

如拉动请求中所述,它应该在咖啡脚本主分支中修复。因此,您可以从GitHub下载最新的源代码,它应该为您解决问题。

否则,请尝试安装旧版本的节点: http://nodejs.org/dist/v0.6.6/

在其他答案中解决的第二个问题是在运行cake命令的目录中需要Cakefile。

答案 1 :(得分:0)

Cakefile应存在于您调用cake

的目录中

答案 2 :(得分:0)

我在cakephp3中遇到过类似的问题。以上解决方案没有奏效。我试图从命令行烘焙插件。

  

cake bake Plugin PageManager

收到上述错误后,我将命令改为跟随,它就像一个魅力。

  

./ cake bake plugin PageManager

希望这对有类似问题的人有所帮助。