我有以下文件:Cakefile不需要* .coffee文件
Cakefile:
require './test'
test.coffee:
console.log 'hi'
another_test.coffee:
require './test'
如果我运行蛋糕,我会得到以下异常:
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)
但是,如果我跑咖啡another_test.coffee,我得到这样的输出:
hi
我用啤酒,咖啡脚本节点使用NPM,并使用以下的版本我安装:
$ node -v
v0.10.24
$ npm -v
1.3.21
$ coffee -v
CoffeeScript version 1.7.1
为什么Cakefile不需要test.coffee?
我认为这是因为节点不能要求.coffee文件(因为cake是一个.js脚本本身),所以我打开了一个不同的问题:http://stackoverflow.com/questions/ 21677931 /节点不需要咖啡文件 – Jose