0

i have a rather simple problem with running coffescript file which uses node js. After compiling this peace of code I can run it with node command, but when I use coffee command with original source require function returns undefined object

 require('util').print 'abc'

2 Answers 2

2

I cannot reproduce this problem:

$ cat test.coffee 
require('util').print 'abc'

$ coffee test.coffee 
abc

I know it doesn't directly answer your question, but perhaps knowing that it works will steer you in the right direction. :)

Sign up to request clarification or add additional context in comments.

3 Comments

thanks, it's interesting, I'll try to reinstall my environment
If it helps, I'm running CoffeeScript 1.4.0 on Node 0.8.14.
I had coffesharp which was hiding nodejs coffee cmd. thanks for help
2

I'm not sure I totally understand your question. You need to know two things:

  1. CoffeeScript wraps all of your code in an immediately invoked function expression
  2. CoffeeScript always returns

Look at your JavaScript output and see if something returns where you didn't expect it to.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.