[coffeScript] coffee script 設定安裝

因為開發平台是使用mac,所以設定的部分將以mac為準。

###設定:

#####環境:

  1. mac os 10.7.2 (Lion)
  2. homebrew

先安裝好 homebrew,homebew的安裝法可參考: ihower的設定方法

接下來,先來安裝Node.js

1
brew install node

再來安裝npm (node package manager)

1
curl http://npmjs.org/install.sh | sh

接下來安裝coffee script

1
npm install -g coffee-script

將node_modules資料夾加到路徑之中

1
export NODE_PATH=/usr/local/lib/node_modules

當設定完成之後,可以直接按下

1
node

此時,會在畫面上看到進入了一個可以鍵入程式的環境,並且是以>開頭的畫面。接下來只要鍵入:

1
require('coffee-script')

如果出現了像以下的訊息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{ VERSION: '1.1.3',
RESERVED:
[ 'case',
'default',
'function',
'var',
'void',
'with',
'const',
'let',
'enum',
'export',
'import',
'native',
'__hasProp',
'__extends',
'__slice',
'__bind',
'__indexOf',
'true',
'false',
'null',
'this',
'new',
'delete',
'typeof',
'in',
'instanceof',
'return',
'throw',
'break',
'continue',
'debugger',
'if',
'else',
'switch',
'for',
'while',
'do',
'try',
'catch',
'finally',
'class',
'extends',
'super',
'undefined',
'then',
'unless',
'until',
'loop',
'of',
'by',
'when',
'and',
'or',
'is',
'isnt',
'not',
'yes',
'no',
'on',
'off' ],
helpers:
{ starts: [Function],
ends: [Function],
compact: [Function],
count: [Function],
merge: [Function],
extend: [Function],
flatten: [Function],
del: [Function],
last: [Function] },
compile: [Function],
tokens: [Function],
nodes: [Function],
run: [Function],
eval: [Function] }

代表設定成功了。要退出目前的狀態只要Control C按個二下就行了。

Author

Walile

Posted on

2011-12-16

Updated on

2016-05-24

Licensed under