Open ypapax opened 9 years ago
This changed a while back with CoffeeScript@1.7.0. Check the main Coffee page, and here's the explanation:
On Sat, Nov 1, 2014 at 7:43 AM, ypapax notifications@github.com wrote:
my app.js is:
require("iced-coffee-script"); require("./serverOneNode.iced");
when I run it:
node app.js
got error:
throw new Error("Use CoffeeScript.register() or require the coffee-s ^
Error: Use CoffeeScript.register() or require the coffee-script/register module to require .iced.md files. at Object._base.(anonymous function) as .iced at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.
(/projectPath/app.js:2:1) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3 That began to happen after I updated iced-coffee-script to version 1.8.0-a and coffee-script to version 1.8.0.
— Reply to this email directly or view it on GitHub https://github.com/maxtaco/coffee-script/issues/138.
Thank you, @maxtaco. When I added line require('iced-coffee-script/register');
to file app.js
before requiring serverOneNode.iced
and so problem was solved.
Following instructions at http://code.tutsplus.com/tutorials/better-coffeescript-testing-with-mocha--net-24696 supplemented by various stackoverflow and other pages, I did all this: npm install mocha npm install chai npm install -g coffee-script npm install iced-coffee-script
coffee -v Using CoffeeScript version 1.9.3
I have a test .coffee file containing chai = require 'chai' chai.should() expect = chai.expect require('coffee-script/register') CoffeeScript.register() ...
When I run mocha --require coffee-script/register --compilers coffee:coffee-script/register I get "CoffeeScript.register(); ^ ReferenceError: CoffeeScript is not defined"
This is also true if I miss out ' --require coffee-script/register' in the mocha line above, or if I install iced-coffee and add "require('iced-coffee-script/register')" to my test .coffee file. What am I missing?
Got it.
CoffeeScript = require('coffee-script')
my app.js is:
when I run it:
got error:
That began to happen after I updated
iced-coffee-script
to version1.8.0-a
andcoffee-script
to version1.8.0
.