Rails3.1 Could not find a JavaScript runtime.错误的解决方法

Web based persistant chat platform using Ruby on Rails 3.1 and ExtJS 4

https://github.com/crueber/ignis

 

$ bundle install
$ rake db:migrate
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.

(See full trace by running task with --trace)
 

 

解决方式是在gemfile中加入

gem 'execjs'
gem 'therubyracer'

 

RHEL5環境成功, RHEL4環境報錯:

 

$ gem install --no-ri --no-rdoc therubyracer
Fetching: libv8-3.3.10.2.gem (100%)
Building native extensions.  This could take a while...
Fetching: therubyracer-0.9.2.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
        ERROR: Failed to build gem native extension.

        /opt/oracle/otk/home/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
Compiling The Ruby Racer...
checking for v8.h in /opt/oracle/otk/home/.rvm/gems/[email protected]/gems/libv8-3.3.10.2/lib/libv8/v8/include... yes
checking for main() in -lpthread... yes
creating Makefile

......

/usr/bin/ld: cannot find -lv8
collect2: ld returned 1 exit status
make: *** [v8.so] Error 1

 

upgrade Python 2.3.4 on RHEL 4  to Python 2.6.1:

 

1.下载源代码
http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tar.bz2
2.   安装
   # tar -jxvf Python-2.6.1.tar.bz2
   # cd Python-2.6.1
   # ./configure
   # make
   # make install

running install_scripts
copying build/scripts-2.6/2to3 -> /usr/local/bin
copying build/scripts-2.6/pydoc -> /usr/local/bin
copying build/scripts-2.6/idle -> /usr/local/bin
copying build/scripts-2.6/smtpd.py -> /usr/local/bin
changing mode of /usr/local/bin/2to3 to 755
changing mode of /usr/local/bin/pydoc to 755
changing mode of /usr/local/bin/idle to 755
changing mode of /usr/local/bin/smtpd.py to 755
running install_egg_info
Writing /usr/local/lib/python2.6/lib-dynload/Python-2.6.1-py2.6.egg-info
if test -f /usr/local/bin/python -o -h /usr/local/bin/python; \
then rm -f /usr/local/bin/python; \
else true; \
fi
(cd /usr/local/bin; ln python2.6 python)
rm -f /usr/local/bin/python-config
(cd /usr/local/bin; ln -s python2.6-config python-config)
/usr/bin/install -c -m 644 ./Misc/python.man \
        /usr/local/share/man/man1/python.1
 

 

還是一樣的問題.

 

RHEL 4环境安装 GCC 4.6:

參考:http://my.oschina.net/cbcgorilla/blog/17371

下载GCC 4.6 及其依赖源码包:
gcc-4.6.0.tar.bz2
gmp-5.0.2.tar.bz2
mpfr-3.0.1.tar.bz2
mpc-0.9.tar.gz

 

# mv /usr/bin/gcc /usr/bin/gcc3

# mv /usr/bin/g++ /usr/bin/g++3

# mv /usr/bin/gcov /usr/bin/gcov3

# mv /usr/bin/c++ /usr/bin/c++3

# mv /usr/bin/cpp /usr/bin/cpp3

# ln -s /usr/local/gcc-4.6.0/bin/gcc /usr/bin/gcc

# ln -s /usr/local/gcc-4.6.0/bin/g++ /usr/bin/g++

# ln -s /usr/local/gcc-4.6.0/bin/gcov /usr/bin/gcov

# ln -s /usr/local/gcc-4.6.0/bin/c++ /usr/bin/c++

# ln -s /usr/local/gcc-4.6.0/bin/cpp /usr/bin/cpp

 

 

 

编译V8:

# rpm -ivh scons-1.2.0-1.el4.rf.noarch.rpm

# tar -zxvf libv8_2.2.24.orig.tar.gz

# cd libv8_2.2.24

# scons

ranlib libv8.a
scons: done building targets.

# cp libv8.a /usr/lib

# cp -r include/* /usr/include/

$svn checkout http://v8.googlecode.com/svn/trunk/ v8
$cd v8
$scons
$sudo cp libv8.a /usr/lib
$sudo cp libv8preparser.a /usr/lib
$sudo cp -r include/* /usr/include/


 

 

安装nodejs

wet http://nodejs.org/dist/node-v0.4.8.tar.gz
tar zxvf node-v0.4.8.tar.gz
cd node-v0.4.8
./configure --prefix=/usr/local/node
make
make install

 

 

 

 

 

你可能感兴趣的:(JavaScript,Web,Ruby,Rails)