読者です 読者をやめる 読者になる 読者になる

DC4

今よく言われてる「草食系」にはなったらあかん! 野獣のような「肉食系」になるため、今は肉ばっかり食べてるよ。

expressとsocket.io

 NodeとNPMは入っているのですが、expressとsocket.ioが入っていないためインストール

 

まずはexpressから。

>sudo npm install express

 

npm http GET https://registry.npmjs.org/express

npm http 304 https://registry.npmjs.org/express

npm http GET https://registry.npmjs.org/connect

npm http GET https://registry.npmjs.org/mime/1.2.4

npm http GET https://registry.npmjs.org/qs

npm http GET https://registry.npmjs.org/mkdirp/0.3.0

npm http 200 https://registry.npmjs.org/mime/1.2.4

npm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz

npm http 200 https://registry.npmjs.org/mkdirp/0.3.0

npm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz

npm http 200 https://registry.npmjs.org/qs

npm http GET https://registry.npmjs.org/qs/-/qs-0.4.2.tgz

npm http 200 https://registry.npmjs.org/connect

npm http GET https://registry.npmjs.org/connect/-/connect-1.8.6.tgz

npm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz

npm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz

npm http 200 https://registry.npmjs.org/qs/-/qs-0.4.2.tgz

npm http 200 https://registry.npmjs.org/connect/-/connect-1.8.6.tgz

express@2.5.8 ./node_modules/express

├── qs@0.4.2

├── mime@1.2.4

├── mkdirp@0.3.0

└── connect@1.8.6

 

次にsocket.io

sudo npm install socket.io

 

npm http GET https://registry.npmjs.org/socket.io

npm http 200 https://registry.npmjs.org/socket.io

npm http GET https://registry.npmjs.org/socket.io/-/socket.io-0.9.3.tgz

npm http 200 https://registry.npmjs.org/socket.io/-/socket.io-0.9.3.tgz

npm http GET https://registry.npmjs.org/socket.io-client/0.9.3

npm http GET https://registry.npmjs.org/policyfile/0.0.4

npm http GET https://registry.npmjs.org/redis/0.6.7

npm http 200 https://registry.npmjs.org/socket.io-client/0.9.3

npm http GET https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.3.tgz

npm http 200 https://registry.npmjs.org/policyfile/0.0.4

npm http 200 https://registry.npmjs.org/redis/0.6.7

npm http GET https://registry.npmjs.org/policyfile/-/policyfile-0.0.4.tgz

npm http GET https://registry.npmjs.org/redis/-/redis-0.6.7.tgz

npm http 200 https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.3.tgz

npm http 200 https://registry.npmjs.org/redis/-/redis-0.6.7.tgz

npm http 200 https://registry.npmjs.org/policyfile/-/policyfile-0.0.4.tgz

npm http GET https://registry.npmjs.org/uglify-js/1.2.5

npm http GET https://registry.npmjs.org/ws

npm http GET https://registry.npmjs.org/xmlhttprequest/1.2.2

npm http GET https://registry.npmjs.org/active-x-obfuscator/0.0.1

npm http 200 https://registry.npmjs.org/uglify-js/1.2.5

npm http GET https://registry.npmjs.org/uglify-js/-/uglify-js-1.2.5.tgz

npm http 200 https://registry.npmjs.org/active-x-obfuscator/0.0.1

npm http GET https://registry.npmjs.org/active-x-obfuscator/-/active-x-obfuscator-0.0.1.tgz

npm http 200 https://registry.npmjs.org/xmlhttprequest/1.2.2

npm http GET https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.2.2.tgz

npm http 200 https://registry.npmjs.org/ws

npm http GET https://registry.npmjs.org/ws/-/ws-0.4.12.tgz

npm http 200 https://registry.npmjs.org/uglify-js/-/uglify-js-1.2.5.tgz

npm http 200 https://registry.npmjs.org/active-x-obfuscator/-/active-x-obfuscator-0.0.1.tgz

npm http 200 https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.2.2.tgz

npm http 200 https://registry.npmjs.org/ws/-/ws-0.4.12.tgz

npm http GET https://registry.npmjs.org/zeparser/0.0.5

 

> ws@0.4.12 preinstall /Users/ユーザー名/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws

> make

 

node-waf configure build

npm http 200 https://registry.npmjs.org/zeparser/0.0.5

npm http GET https://registry.npmjs.org/zeparser/-/zeparser-0.0.5.tgz

Checking for program g++ or c++ : /usr/bin/g++

Checking for program cpp : /usr/bin/cpp

Checking for program ar : /usr/bin/ar

Checking for program ranlib : /usr/bin/ranlib

Checking for g++ : ok

Checking for node path : not found

Checking for node prefix : ok /opt/local

'configure' finished successfully (0.732s)

Waf: Entering directory `/Users/ユーザー名/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'

[1/4] cxx: src/validation.cc -> build/Release/src/validation_1.o

[2/4] cxx: src/bufferutil.cc -> build/Release/src/bufferutil_2.o

npm http 200 https://registry.npmjs.org/zeparser/-/zeparser-0.0.5.tgz

[3/4] cxx_link: build/Release/src/validation_1.o -> build/Release/validation.node

[4/4] cxx_link: build/Release/src/bufferutil_2.o -> build/Release/bufferutil.node

Waf: Leaving directory `/Users/ユーザー名/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'

'build' finished successfully (2.542s)

npm http GET https://registry.npmjs.org/commander

npm http GET https://registry.npmjs.org/options

npm http 200 https://registry.npmjs.org/commander

npm http GET https://registry.npmjs.org/commander/-/commander-0.5.2.tgz

npm http 200 https://registry.npmjs.org/options

npm http GET https://registry.npmjs.org/options/-/options-0.0.3.tgz

npm http 200 https://registry.npmjs.org/commander/-/commander-0.5.2.tgz

npm http 200 https://registry.npmjs.org/options/-/options-0.0.3.tgz

socket.io@0.9.3 ./node_modules/socket.io

├── policyfile@0.0.4

├── redis@0.6.7

└── socket.io-client@0.9.3

 

 

ここまでのコマンドを千と千尋を見ながら叩く。

 

まずexpressを使ってみる。

 

こちらを参考にさせていただきました。

 

socket.ioは解るけど、npmってExpressでひな壇作る度に必要なのかな?

 

サンプルの動作完了。