I am new to coffeescript. I saw a coffeescript video in Rails casts.com. From that episode I understand how to convert the normal Js and Jquery to coffeescript code and the usage of coffeescript.
I am trying to create a coffeescript example without rails. I wetn through the coffeescript site. They first install Node.js. I tried to install node.js in windows and ubuntu, but I had failures. I followed the instruction as per this site:
http://howtonode.org/how-to-install-nodejs#ubuntu
For ubuntu I got "bash: ./configure?: No such file or directory" error when I execute the following command
./configure
Can anyone help me to create simple coffescript example without rails?
One more thing - In Mac "By the help of homebrew I can see the compiled js of coffescript code through compiled and Display Js window". Are there any options available in windows and ubuntu?
I would bet the easiest way to install Node.js on Ubuntu is through APT:
$ sudo apt-get install nodejs
It probably will get some outdated version but it can be enough for some tests.
If you prefer the latest version (which is a reasonable preference), I bet it would be easier to install Node.js from the dist package. Just copy and paste this on terminal:
wget http://nodejs.org/dist/node-v0.5.0.tar.gz && \
tar zvxf node-v0.5.0.tar.gz && \
cd node-v0.5.0 && \
./configure && \
make && \
sudo make install
This line will:
wget http://nodejs.org/dist/node-v0.5.0.tar.gz
tar zvxf node-v0.5.0.tar.gz
cd node-v0.5.0
./configure
make
sudo make install
The &&
means "execute the next command if the previous command succeeds" (for example wget http://nodejs.org/dist/node-v0.5.0.tar.gz && tar zvxf node-v0.5.0.tar.gz
means that we will download the package with wget
and iff the download succeeds we will unpack the download file with tar
. The backslashes ( \
) are here for allowing us to break all the series of commands in more than one line because, by default, we would have a big line:
wget http://nodejs.org/dist/node-v0.5.0.tar.gz && tar zvxf node-v0.5.0.tar.gz && cd node-v0.5.0 && ./configure && make && sudo make install
Then, you can install npm
with this simple command, found in the own npm
github page :
$ curl http://npmjs.org/install.sh | sudo sh
With npm
, it will be too easy to install coffee, as you can see in the CoffeeScript page :
$ npm install coffee-script
Now, just run your tests:
$ coffee
coffee> a = key: 'value'
{ key: 'value' }
coffee> a.key
'value'
Does it look like to much work? You can try CoffeeScript in the language page . Just click in "Try CoffeeScript" and a console will appear to you.
For testing and demo purposes it may be sufficient to have your CoffeeScript compiled directly in browser. You can include the CoffeeScript compiler and your code in a tag.
This method is not efficient though so please use it for playing around.
Please see this section on how to set things up:
"text/coffeescript" Script Tags
Good luck!
Ubuntu 11.10 has an up-to-date package for CoffeeScript .
sudo apt-get install coffeescript
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.