Last active
September 25, 2023 01:23
-
-
Save lnfel/d84ead4b914fd3e4e7897537d8f61535 to your computer and use it in GitHub Desktop.
Rails 6.0.3.2 on Termux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails 6.0.3.2 on Termux | |
pkg upgrade | |
pkg install ruby vim git nodejs | |
nokogiri will build natively and would need the ff packages and will need pkg-config to find them: | |
libxml-2 | |
libxslt | |
libexslt | |
pkg install pkg-config | |
libxml-2 (2.9.10-3) is installed when you run: | |
pkg install build-essentials | |
pkg install libxslt | |
pkg install libexslt will not work, I guess it's already bundled with libxslt | |
tried running: | |
gem install nokogiri -- --use-system-libraries | |
nokogiri was successfully installed | |
finally install rails without docs, we dont want them taking up space: | |
gem install rails --no-doc | |
libsqlite for sqlite3 gem | |
pkg install libsqlite | |
install yarn first before running rails new: | |
pkg install yarn | |
ffi and rb-inotify are already included via bundle when you run: | |
rails new | |
gem install tzinfo-data | |
tzinfo-data issue when running rails server: | |
rubygems/rubygems#3212 | |
try removing the Gemfile.lock and running the bundle install again. | |
or | |
Running bundle update tzinfo | |
What worked for me is: | |
changing | |
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] | |
to | |
gem 'tzinfo-data' | |
then deleting Gemfile.lock and running bundle install again | |
now run the server via `rails server` and browse `localhost:3000` on any browser on your device. | |
All is well until we create our first controller and change the routes root path: | |
rails generate controller Dashboard index | |
and on config/routes.rb file: | |
root to: 'dashboard#index' | |
then browsing again to our browser on `localhost:3000` gives us this 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: | |
{ | |
} | |
tried running compilation on test environment: | |
RAILS_ENV=test NODE_ENV=test bundle exec rails webpacker:compile | |
this returns `Errno::EACCES: Permission denied @ rb_sysopen` | |
I haven found a solution to this issue at the time of this writing. | |
RAILS_ENV=development NODE_ENV=development bundle exec rails webpacker:compile | |
got an error `webpack command is not found` | |
added webpack via: | |
yarn add webpack | |
then re-ran `RAILS_ENV=development NODE_ENV=development bundle exec rails webpacker:compile` | |
it will ask: "Do you want to install 'webpack-cli' (yes/no): | |
yes | |
then Termux bugs out with repeated: | |
y | |
y | |
y | |
y | |
y | |
y | |
y | |
y | |
y | |
y... endlessly | |
add webpack-cli manually and @rails/webpacker module: | |
yarn add webpack-cli -D | |
yarn add @rails/webpacker | |
we also need python2 | |
pkg install python2 | |
try running: | |
rails assets:precompile | |
just figured the above code is the shorthand for `RAILS_ENV=development NODE_ENV=development bundle exec rails webpacker:compile` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment