Coffeescript Cakefile不需要*.coffee文件

Coffeescript Cakefile不需要*.coffee文件,coffeescript,cakefile,Coffeescript,Cakefile,我有以下文件: Cakefile: require './test' 测试。咖啡: console.log 'hi' require './test' 另一个测试:咖啡: console.log 'hi' require './test' 如果我运行cake,我会得到以下异常: module.js:340 throw err; ^ Error: Cannot find module './test' at Function.Module._resolve

我有以下文件:

Cakefile:

require './test'
测试。咖啡:

console.log 'hi'
require './test'
另一个测试:咖啡:

console.log 'hi'
require './test'
如果我运行cake,我会得到以下异常:

module.js:340
    throw err;
          ^
Error: Cannot find module './test'
  at Function.Module._resolveFilename (module.js:338:15)
  at Function.Module._load (module.js:280:25)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/Users/jose/Desktop/Cakefile:2:3)
  at Object.<anonymous> (/Users/jose/Desktop/Cakefile:4:4)
  at Module._compile (module.js:456:26)
我使用npm使用brew和coffee脚本安装了node,并使用以下版本:

$ node -v
v0.10.24
$ npm -v
1.3.21
$ coffee -v
CoffeeScript version 1.7.1

为什么Cakefile不能要求test.coffee?

您尝试过使用绝对路径吗?请尝试以下方法:

  require "#{__dirname}/test"

您是否尝试过使用绝对路径?请尝试以下方法:

  require "#{__dirname}/test"

您是否尝试过使用绝对路径?请尝试以下方法:

  require "#{__dirname}/test"

您是否尝试过使用绝对路径?请尝试以下方法:

  require "#{__dirname}/test"
通过添加以下内容解决:

require 'coffee-script/register'
在Cakefile上面。请参阅:

通过添加以下内容解决:

require 'coffee-script/register'
在Cakefile上面。请参阅:

通过添加以下内容解决:

require 'coffee-script/register'
在Cakefile上面。请参阅:

通过添加以下内容解决:

require 'coffee-script/register'

在Cakefile上面。请参阅:

Thx,不走运,同样的错误。此外,Cakefile还需要一个./test.js文件,所以它看起来不像是路径问题,更像是一个扩展。Thx,不走运,同样的错误。此外,Cakefile还需要一个./test.js文件,所以它看起来不像是路径问题,更像是一个扩展。Thx,不走运,同样的错误。此外,Cakefile还需要一个./test.js文件,所以它看起来不像是路径问题,更像是一个扩展。Thx,不走运,同样的错误。另外,Cakefile可以需要一个./test.js文件,所以它看起来不像是路径问题,更像是一个扩展。我认为这是因为node无法需要.coffee文件(因为cake本身就是一个.js脚本),所以我提出了一个不同的问题:我认为这是因为node无法需要.coffee文件(因为cake本身是一个.js脚本),所以我打开了一个不同的问题:我认为这是因为node不能要求.coffee文件(因为cake本身是一个.js脚本),所以我打开了一个不同的问题:我认为这是因为node不能要求.coffee文件(因为cake本身是一个.js脚本),所以我提出了一个不同的问题: