FreeBSDにnode.jsをインストールしてみる
portsにあるから,一瞬じゃね?と思ったのですが,
# cd /usr/ports/www/node # make Makefile:33: *** missing separator. Stop. wiles# gmake Makefile:33: *** missing separator. Stop.
面倒なので自分で入れます.その方が性にあっている...
> wget http://nodejs.org/dist/node-v0.4.12.tar.gz > tar xvf node-v0.4.12.tar.gz > cd node-v0.4.12 > ./configure --prefix=/usr/local configure build (中略) scons: Reading SConscript files ... scons: warning: Ignoring missing SConscript 'obj/test/release/SConscript' File "/home/tetu-s/node-v0.4.12/deps/v8/SConstruct", line 1201, in BuildSpecific scons: done reading SConscript files. scons: Building targets ... g++ -o obj/release/ia32/code-stubs-ia32.o -c -Wall -W -Wno-unused-parameter -Wnon-virtual-dtor -m32 -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -fno-rtti -fno-exceptions -Wall -W -Wno-unused-parameter -Wnon-virtual-dtor -m32 -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -DV8_TARGET_ARCH_IA32 -DENABLE_VMSTATE_TRACKING -DENABLE_LOGGING_AND_PROFILING -DENABLE_DEBUGGER_SUPPORT -I/usr/local/include -I/home/tetu-s/node-v0.4.12/deps/v8/src /home/tetu-s/node-v0.4.12/deps/v8/src/ia32/code-stubs-ia32.cc In file included from /usr/local/include/jspubtd.h:45, from /usr/local/include/jsregexp.h:46, from /home/tetu-s/node-v0.4.12/deps/v8/src/ia32/code-stubs-ia32.cc:34: /usr/local/include/jstypes.h:248:6: error: #error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX" /usr/local/include/jstypes.h:264:2: error: #error No suitable type for JSInt8/JSUint8 /usr/local/include/jstypes.h:277:2: error: #error No suitable type for JSInt16/JSUint16 /usr/local/include/jstypes.h:297:2: error: #error No suitable type for JSInt32/JSUint32 /usr/local/include/jstypes.h:348:2: error: #error 'sizeof(int)' not sufficient for platform use
あれ,CentOSだと通ったのに.仕方が無いのでオプションを指定します.
> env CPPFLAGS=-DXP_UNIX ./configure --prefix=/usr/local configure build (中略) Waf: Leaving directory `/home/hoge/node-v0.4.12/build' 'build' finished successfully (9m48.672s) > su # ./configure install (中略) Waf: Leaving directory `/home/hoge/node-v0.4.12/build' 'install' finished successfully (52.000s) # exit exit > node -v v0.4.12
OK.
せっかくなので,Hello Worldくらいは実行してみましょう.
> echo 'console.log("%s","Hello, World");' > /tmp/hello.js ; node /tmp/hello.js ; rm /tmp/hello.js Hello, World