【问题标题】:Accessing App in web browser creating by "refinerycms" in linux machine?在Linux机器中由“refinerycms”创建的Web浏览器中访问应用程序?
【发布时间】:2013-11-22 06:24:22
【问题描述】:

我在我的 linux 终端中创建了一个应用程序“my_new_app”,如下所示:

u107@mint107 ~ $ refinerycms /home/u107/my_new_app
      create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  app/mailers/.gitkeep
      create  app/models/.gitkeep
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/tasks/.gitkeep
      create  lib/assets
      create  lib/assets/.gitkeep
      create  log
      create  log/.gitkeep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  script
      create  script/rails
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.gitkeep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.gitkeep
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
       apply  /var/lib/gems/1.9.1/gems/refinerycms-2.1.0/templates/refinery/installer.rb
/var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
    from /var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from /var/lib/gems/1.9.1/gems/refinerycms-2.1.0/templates/refinery/installer.rb:6:in `apply'
    from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions.rb:221:in `instance_eval'
    from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions.rb:221:in `apply'
    from /var/lib/gems/1.9.1/gems/railties-3.2.15/lib/rails/generators/app_base.rb:109:in `apply_rails_template'
    from (eval):1:in `apply_rails_template'
    from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
    from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
    from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `block in invoke_all'
    from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `each'
    from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `map'
    from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `invoke_all'
    from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/group.rb:233:in `dispatch'
    from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
    from /var/lib/gems/1.9.1/gems/refinerycms-2.1.0/bin/refinerycms:43:in `<top (required)>'
    from /usr/local/bin/refinerycms:23:in `load'
    from /usr/local/bin/refinerycms:23:in `<main>'
u107@mint107 ~ $ ^C
u107@mint107 ~ $ cd /home/u107/my_new_app/
u107@mint107 ~/my_new_app $ rails server
/var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
    from /var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
    from /var/lib/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
    from /var/lib/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
    from /var/lib/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/u107/my_new_app/config/application.rb:13:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/railties-3.2.15/lib/rails/commands.rb:53:in `require'
    from /var/lib/gems/1.9.1/gems/railties-3.2.15/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /var/lib/gems/1.9.1/gems/railties-3.2.15/lib/rails/commands.rb:50:in `tap'
    from /var/lib/gems/1.9.1/gems/railties-3.2.15/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
u107@mint107 ~/my_new_app $ 

目录结构是这样的:

./log
./script
./config
./config/locales
./config/initializers
./config/environments
./lib
./lib/tasks
./lib/assets
./public
./vendor
./vendor/plugins
./vendor/assets
./vendor/assets/stylesheets
./vendor/assets/javascripts
./db
./tmp
./tmp/cache
./tmp/cache/assets
./app
./app/views
./app/views/layouts
./app/helpers
./app/models
./app/assets
./app/assets/images
./app/assets/stylesheets
./app/assets/javascripts
./app/controllers
./app/mailers
./doc

所以我遇到了一个问题,我不知道如何在网络浏览器中访问它 请告诉我如何在网络浏览器中查看此应用程序。 请迅速回答。 提前致谢

Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
u107@mint107 ~/my_new_app $ rails server
/var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
    from /var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
    from /var/lib/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
    from /var/lib/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
    from /var/lib/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/u107/my_new_app/config/application.rb:13:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/railties-3.2.15/lib/rails/commands.rb:53:in `require'
    from /var/lib/gems/1.9.1/gems/railties-3.2.15/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /var/lib/gems/1.9.1/gems/railties-3.2.15/lib/rails/commands.rb:50:in `tap'
    from /var/lib/gems/1.9.1/gems/railties-3.2.15/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

【问题讨论】:

    标签: ruby linux browser refinerycms linux-mint


    【解决方案1】:

    根据文档,进入您的项目(包含您列出的文件夹的项目),然后运行:

    rails server或简称rails s,在你确定你已经捆绑之后。

    您可以查看文档here。然后,您可以在浏览器中的 localhost:3000 中看到它,就像任何其他 ruby​​ Web 应用程序一样(只要您不在 rails server 命令上使用 -b-p。如果这样做,您必须更改它相应的网址)。

    编辑:

    根据您的更新,您需要一个 javascript 运行时。您可以为此使用therubyracer,因为大多数时候它默认包含在您的Gemfile 中,用于rails 项目。您应该检查您的Gemfile 是否有gem "therubyracer",如果它被注释掉,请取消注释并重新捆绑,然后再次尝试rails s

    【讨论】:

    • 先生,我刚刚尝试过但还没有工作。我已经改变了问题,所以请看看我在输入 rails s 后得到了什么
    • 我必须在哪里检查这个?好的,它在根文件夹中,如下所示:# gem 'therubyracer', :platforms => :ruby
    • 它应该在您的项目目录中,因为您可以在refinerycms 的输出中看到:create Gemfile 在那里。
    • 这里我只需要删除#号吗?
    • 好的,先生,现在我将其设置为 gem 'therubyracer',:platforms => :ruby 好吧,我现在必须启动 rails s 吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-26
    • 1970-01-01
    • 1970-01-01
    • 2012-01-11
    • 1970-01-01
    • 1970-01-01
    • 2017-10-21
    相关资源
    最近更新 更多