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