4. Basic Installation For Windows
Run In CMD
• Can JavaScript run from the command line ?
May be not, but Coffee Script will change your view. With Node.js,
you can now run JavaScript from the command line or as part of
an executable script.
• This key feature of Node.js allows Coffee Script code to be
executed on the command line, providing the runtime needed for
the Coffee Script compiler (which is written in Coffee Script).
5. Basic Installation For Window
Run In CMD
•
The very first step is to install Node.js in your windows. You have
several options for installation; you could compile the source code
or run one of the installers that are available for various systems.
• Node includes the npm package manager on OS X and Windows.
Choose .pkg for OS X and .msi for Windows and install node from
http://nodejs.org/dist/v0.6.6/ — See http://nodejs.org/dist/ for
newer versions.
• Run node -v from the command line to confirm that Node.js is
installed on the same path.
6. Installation and Test Installation
with Following Command
• node --version
Run this commands in your
command prompt
• coffee –version
• coffee -e "console.log 'Hello World'" # Hello World
7. How to run Coffee Script in CMD
• Running the Coffee Script compiler is as easy as entering “coffee c”, which launches the Coffee Script read-evaluate-print-loop (REPL).
• To execute the compiler, you need to pass it a Coffee Script file that
you want to compile. Create a file called cup0.coffee and paste
following Source code into the file.
Example Code:
• for i in [0..5] console.log "Hello #{i}“
– Save it in filename.coffee