In ubuntu, the Rails Server encounters the cocould not find a JavaScript runtime problem.

Source: Internet
Author: User

It was very difficult to install Rails on ubuntu today, and the installation was successful. However, when starting the server, the main error message is cocould not find a JavaScript runtime. I checked a lot of information on the Internet. This means that the js runtime environment is not found. It is installed by default in windows, but it must be installed by myself in ubuntu, at the beginning, add the following statement to Gemfile:
 
Gem 'execjs'
 
Gem 'therubyacer'
 
Then run bundle install
 
When I did this, it showed that therubyacer was not found, so I had to continue to find the solution and finally find it. the following command:
 
Sudo apt-get install python-software-properties sudo add-apt-repository ppa: chris-lea/node. js sudo apt-get update sudo apt-get install nodejs
Then there is no problem.
 
Also encountered a problem: ARN TCPServer Error: Address already in use-bind (2) Exiting
 
The prompt message is that the port you enabled is occupied, so:
 
 
1. Enter the command (find the pid of port 3000 ):
Netstat-tulpn | grep 3000
Of course, you will see -->
Tcp 0 0 127.0.0.1.3000 0.0.0.0: * LISTEN
1877/ruby
2. Run the following command to kill the occupied pid ):
Kill-9 1877
3. Restart ruby script/server.
Method 2:
Run the ps command to view all processes enabled on the current terminal. Of course, you will find a ruby process. We can see its PID (assuming the PID is 6523 ). Therefore, execute the following command:
Kill-9 6532
Then re-enter the rails project and start ruby script/server.

From Meng xiangyue's column

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.