First Rails project: Problem installing yarn - ruby-on-rails

I am trying to get started with Rails, following the guide at https://guides.rubyonrails.org/getting_started.html, but I'm running into problems.
I've got ruby, sqlite3, and rails installed as required, and then run
rails new blog
as indicated in section 3.2 of the tutorial. I get an error saying "Your user account isn't allowed to install to the system RubyGems.", but I can install the gems into ./vendor/bundle, as suggested (I don't have full root access on this machine).
So far, so good. But then
rails webpacker:install
is run by the process, which gives me the following message:
Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/
Of course, I went to that website and checked the instructions for my Fedora system and tried to follow them. The problem is again: I have limited root access, I cannot run the suggested commands; in particular, I cannot write to /etc/yum.repos.d/yarn.repo.
I also googled a bit, and what I could do is following https://developer.fedoraproject.org/tech/languages/nodejs/nodejs.html to install Node.js and Yarn (including setting the alias yarn for nodejs-yarn). But still, running
rails webpacker:install
says that Yarn is not installed.
Any help is greatly appreciated, I have to admit that I don't really know what I'm doing. Thanks!

On linux, the sudo command is the intended way to temporarily elevate user privledges.
wget https://yarnpkg.com/install.sh
sudo ./install.sh
That should get Yarn installed for you. The other problem it seems your having is installing ruby gems. You should be able to write to the vendor directory of your application by default, so make sure that you're doing this project in your /home/<MY USER NAME HERE> directory.

Related

RubyMine's run config results in error that "Yarn requires Node.js 4.0" on Ubuntu

On my Elementary OS machine (an Ubuntu-based OS), after creating a new Ruby on Rails project with rails new yarntest and loading it in RubyMine, I could not launch it with RubyMine's "Development: yarntest" run configuration. The output was:
=> Booting Puma
=> Rails 6.0.1 application starting in development
=> Run `rails server --help` for more startup options
Yarn requires Node.js 4.0 or higher to be installed.
========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================
To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).
However, running rails server in the console worked.
I tried reinstalling Yarn, but it still did not work.
I could only disable the Yarn integrity check in the Ruby on Rails config as stated in the error message (deleting the yarn.lock also appeared to work, but is surely wrong). Similarly, I did not want to track down and remove the different Yarn version, as suggested on another question, since the issue was with RubyMine.
I came across an answer on another question that mentioned this error message when running sudo yarn install (i. e. in sudo mode). I tried running sudo yarn install and could finally reproduce the error message outside of RubyMine's run config. Apparently, when running in sudo mode, the yarn binary was outdated.
The solution is therefore to point RubyMine to the correct yarn binary.
The easiest way to do that is to launch RubyMine from the terminal with rubymine, as pointed out by Olivia. See the related JetBrains ticket.

Error in first RubyMine project: "Dont run Bundler as root"

I'm trying to setup my first RubyMine project (previously I used an IDE where the environment comes fully setup for Rails).
Upon cloning a repo and opening, I'm unable to install the necessary gems, and getting an error.
40:232: execution error: Don't run Bundler as root. Bundler can ask
for sudo if it is needed, and installing your bundle as root will
break this application for all non-root users on this machine.
Reproducing the error:
There is a popup when opening the project.
RubyMine has detected that some of the gems required for 'job_tracker_1' are not installed
I check run with sudo, and click install missing gems.
Then I receive an error (shown above).
Alternatively:
If I run bundle in the terminal, the response is bash: bundle: command not found.
Can anyone adivse how to get around this issue?
There is no need to install gems with super user access that is with sudo, if necessary it might prompt for that.
The reason is installing with sudo will install it for all users as root. If multiple people are using your machine this might cause weird behavior. Even though if you're the single user its recommended to install gems local to your home folder usually.
Uncheck run with sudo and click install missing gems

Gem installed but 'command not found'

I've installed a Ruby gem called wordmove to work with pushing and pulling my Wordpress sites but when I run wordmove commands I get the error command not found. I've done some research and I haven't come up with much, I've come to the conclusion based on what I've seen that my Ruby install is messed up.
I ran echo "$PATH" from my root and it returned the following:
/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/brettgolding/.rbenv/shims:/usr/local/bin:/user/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin
I am a noob with the terminal so have no idea how to clean this mess up.
So you're working with rbenv. According to its README, you should run rbenv rehash after installing any gems that have an executable command. Also, run it anytime you install a new Ruby version.

Permission denied. Rails could not complete the installation

I tried to install Ruby on Rails in my user account. Atraves user terminal, do the following.
I find that the minimum requirements are met
I write the command line to install Rails (poor man).
I get the following error message at the beginning of the installation process:
Searching for binary rubies, this might take some time.
Checking requirements for debian.
Installing requirements for debian
user password required for /usr/bin/env PATH=/usr/local/bin:/usr/bin:/bin:usr/local /games:/usr/games:/home/user/.rvm/bin:/sbin:/usr/sbin:/usr/local/sbin apt-get --quiet --yes update:
Updating system.
Error running requirements_debian_update_system ruby-2.0.0-p247, please read /home/user.rvm/log/1380100570_ruby-2.0.0-p247/update_system.log
Requirements installation failed with status: 1.
Maybe your problem is related with sudoers file.
try edit this file:
vim /etc/sudoers
in this file should be your user name with permissions. For example:
your_user_name ALL=(ALL) ALL
try to add if it don't exists:)
I solved the problem by reinstalling ruby separately with the version I wanted to use.
Then install rails via gem install rails-v
then clear the gem that made ​​reference to the error and rerun bundle install . Then select the version I wanted to use installing ruby rvm rvm use default -v

Installation instructions for Fat Free CRM?

Does anyone know of a tutorial or detailed instruction set for installing Fat Free CRM? The instructions on github are clearly meant for experienced rails developers not stupid newbies like me.
When I try downloading the source code to my Mac, rails won't work and I get dozens and dozens of errors when I try to start the server. (There are way too many to even post here) I also tried setting up a new app and painstakingly copying and pasting the files from the source into the new app after it complained numerous times that it could not find the rails server. Now it continues kvetching about syntax errors and dependencies in a dozen or so files and complaining about my gems.
I did properly update the database yaml file and have tried updating my gems and running bundle many, many times but the spaghetti bowl of errors never seems to resolve much. This is the latest Rails 3 version of the app so why would it not work and why does it seem to think that half the gems are deprecated? Other people don't seem to be getting these types of errors.
I'm clearly missing something that is plainly obvious to the rest of the world and have somehow majorly screwed up the installation. How does the process of downloading a complete app differ from installing a plugin? (I've never had this much trouble with plugins.) Does anyone know of an idiot-proof checklist for downloading, installing and setting up this app? After three months of trying to make this work, I am beyond frustrated.
Thanks so much.
The first places to look
1) The Wiki Guide
2) The Readme
Here are the steps I took on Ubuntu, mostly in this order. Remember to try to complete each step without getting errors. If you get errors then it won't work.
sudo cp -r fatfreecrm/ /var/www (Copy crm to your www root)
sudo apt-get install rails (install rails + ruby + mysql)
cd /var/www/fatfreecrm
cp config/database.mysql.yml config/database.yml (copy mysql config over)
chmod 777 config/database.yml (set write permissions)
vim config/database.yml (set db password, remove /tmp/mysql.sock )
gem install bundler (install bundler)
PATH=$PATH:/var/lib/gems/1.8/bin/ ( put bundler on your path, or not )
sudo gem install mysql2 -- --with-mysql-dir=/etc/mysql/ (install mysql2)
sudo /var/lib/gems/1.8/bin/bundle install (install bundle gems)
rake db:create
rake crm:setup
rake crm:demo:load
rake crm:settings:load
sudo ruby script/rails server
Good luck finding what works for you!

Resources