-1

三星 Dex 只是一个声明,因为它将 termux 处理为任何 Android 环境。

我想使用 termux 在我的 android 环境中运行本地 rails 服务器。我想知道我必须配置哪些依赖项和安装才能成功。

4

2 回答 2

0

Termux 上的 Rails 6.0.3.2

pkg upgrade
pkg install ruby vim git nodejs

nokogiri 将在本地构建,并且需要 ff 包,并且需要 pkg-config 来找到它们:

  • libxml-2
  • libxslt
  • libexslt

所以安装 pkg-config

pkg install pkg-config

运行时会安装 libxml-2 (2.9.10-3):

pkg install build-essentials

pkg 安装 libxslt

pkg install libexslt 不起作用,我猜它已经与 libxslt 捆绑在一起

尝试运行:

gem install nokogiri -- --use-system-libraries

nokogiri 安装成功

最后安装没有文档的rails,我们不希望它们占用空间:

gem install rails --no-doc

用于 sqlite3 gem 的 libsqlite

pkg install libsqlite

在运行 rails new 之前先安装 yarn:

pkg install yarn

运行时,ffi 和 rb-inotify 已经包含在 bundle 中: rails new

gem install tzinfo-data

运行 rails 服务器时出现 tzinfo-data 问题:rubygems/rubygems#3212

尝试删除 Gemfile.lock 并再次运行捆绑安装。或运行 bundle update tzinfo

对我有用的是从以下位置更改 Gemfile 中的 tzinfo-data gem:

gem 'tzinfo-data',平台:[:mingw,:mswin,:x64_mingw,:jruby]

宝石'tzinfo-data'

然后删除 Gemfile.lock 并再次运行 bundle install

现在通过运行服务器rails serverlocalhost:3000在您设备上的任何浏览器上浏览。

在我们创建第一个控制器并更改路由根路径之前,一切都很好:

rails generate controller Dashboard index

在 config/routes.rb 文件中:

root to: 'dashboard#index'

然后再次浏览到我们的浏览器localhost:3000会给我们这个 ActionVew::TemplateError:

Webpacker can't find application in <my app path>/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
   unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
}

尝试在测试环境中运行编译:

RAILS_ENV=test NODE_ENV=test bundle exec rails webpacker:compile

这返回Errno::EACCES: Permission denied @ rb_sysopen

在撰写本文时,我还没有找到解决此问题的方法。

于 2020-07-26T06:03:30.443 回答
-1

脚步:

  1. 安装 termux 并运行它。运行以下命令:
  2. 适当的更新
  3. 适当升级
  4. apt install ruby​​ cmake sqlite libxslt node.js yarn
  5. xcode-选择安装(this command might be avoidable)
  6. 宝石安装导轨
  7. pkg 安装 wget
  8. wget https://github.com/termux/termux-packages/files/2912002/fix-ruby-bigdecimal.sh.txt
  9. bash 修复-ruby-bigdecimal.sh.txtThis later 3 commands are for fixing bigdecimal problem
  10. rails webpacker:安装
  11. 在您处理的每个 Rails 项目中,按如下方式修改 gemfile:替换

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

为了

gem 'tzinfo-data', '~> 1.2019', '>= 1.2019.2'

正如这里所解释的

这至少应该解决我遇到的大部分问题

于 2019-08-17T17:38:09.310 回答