Server at (localhost:27017) reports wire version (4), but this version of the Ruby driver requires at least (6) - ruby-on-rails

Server at (localhost:27017) reports wire version (4), but this version of the Ruby driver requires at least (6).
i am using ubuntu 16.04
and ruby -v 3.0.2
rails 6.1.4.1
it not insert and fetch data from data base

I faced the same issue. This error is raised by Mongo-Ruby-Driver from line 71.
The error states that Mongo-Ruby-Driver is not compatible with the MongoDB you are running.
I was running MongoDB with version 3.2, and updated it to 5.0.5, which works like a charm.
Here are the steps I took:
ps ax | grep mongo
Change processID with your Mongo process id:
kill -9 processID
Install latest Mongodb and unlink the old version:
brew install mongodb-community
brew unlink mongodb-community#3.2
Update LaunchAgent:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
Update .zshrc if required:
echo 'export PATH="/usr/local/opt/mongodb-community/bin:$PATH"' >> ~/.zshrc
Link & start MongoDB:
brew link mongodb-community
brew services restart mongodb-community
Start MongoDB:
mongod --dbpath ~/data/db
# Make sure you have access rights to ~/data/db directory.
If you get this error:
Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}}
You can fix it by removing this file:
sudo rm -rf /tmp/mongodb-27017.sock

Related

Where can i find the mongoexport command in suse os?

When i install the mongodb with the command zypper in mongo, then i got mongodb 4.2 installed in my os.
Few days after, i am gonner to backup the data in db. But i can not find the command mongoexport.
When i try to install it with the comand zypper se mongoexport, i got nothing
The version of mongodb is 3.4.10
host1:/usr/bin # mongo -host 127.0.0.1 -port 2222
MongoDB shell version v3.4.10
connecting to: mongodb://127.0.0.1:2222/
MongoDB server version: 3.4.10
I will appriciate it so much if anyone provide some method to install the command.
The version of mongodb is too old, when i upgrade to mongodb 4.2, it contains the mongoexport/mongoimport tools in it.

Install Mysql 5.7 on High Sierra

I want to install mysql 5.7 on my Mac OS 10.13.5. However, brew install mysql installs version 8.0 which is not suited for my project. Forgive me if this question was asked before but I could not find a solution.
Now it's bit differently
brew install mysql#5.7
$ brew install mysql55
This installs a specific version 5.5 which exists along with 8.0
Also mysql entry should be added to .bash_profile to make sure it load and then server start should be done.
$ brew services start mysql#5.5
Below command gives the sequence of how the files are loaded in sequence.
$ mysql --verbose --help | grep my.cnf
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
While installing first mysql server instance works perfectly, installing a different version of mysql instance should be configured properly and the paths of installation, log files and other components have different path.
Installation paths be found here, for eg.
mysql -> ../Cellar/mysql/8.0.11/bin/mysql

(React on Rails) The engine "node" is incompatible with this module. Expected version "..."

For those familiar with the react-on-rails gem, or more generally, yarn:
Just today I updated my Node version to 8.8.1 via Homebrew. Now, when I attempt to run bundle && yarn && foreman start -f Procfile.dev (or just yarn install), I get the following message:
error react-webpack-rails-tutorial#0.0.1: The engine "node" is
incompatible with this module. Expected version "5.10.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation
about this command.
This is likely a very simple issue I am running into, but I have been unable to fix it after a few hours of debugging.
I tried manually updating my Node version in package.json to be that on my computer (did not seem to take effect whatsoever), downgrading my version to 5.10.0 via Homebrew (but was unable to), and even upgrading to the latest version of the gem which meant installing webpack as well.
No matter what I did, my local server startup (bundle && yarn && foreman start -f Procfile.dev) still lead to the same error above. Any ideas for this poor soul?
For anyone running into this same issue, I have not found a solution for the underlying issue but I have found a temporary workaround.
Simply run
bundle && yarn --ignore-engines && foreman start -f Procfile.dev
instead of
bundle && yarn && foreman start -f Procfile.dev
I hope this helps someone else that may have found themselves stuck in the same situation!
You need to update your Node.js version. Try to
Clear NPM's cache:
sudo npm cache clean -f
Install a little helper called 'n'
sudo npm install -g n
Install latest stable Node.js version
sudo n stable
I give you this list of checks to do from the react-webpack-rails-tutorial github page
Basic Demo Setup
Be sure that you have Node installed! We suggest nvm, with node version v6.0 or above. See this article Updating and using nvm.
git clone git#github.com:shakacode/react-webpack-rails-tutorial.git
cd react-webpack-rails-tutorial
Check that you have Ruby 2.3.0 or greater
Check that you're using the right version of node. Run nvm list to check. Use 5.5 or greater.
Check that you have Postgres installed. Run which postgres to check.
Use 9.4 or greater.
Check that you have qmake installed. Run which qmake to check. If
missing, follow these instructions: Installing Qt and compiling
capybara-webkit
Check that you have Redis installed. Run which redis-server to
check. If missing, install with Homebrew (brew install redis) or
follow these instructions.
bundle install
brew install yarn
yarn
rake db:setup
foreman start -f Procfile.hot
Open a browser tab to http://localhost:3000 for the Rails app
example with HOT RELOADING
Try Hot Reloading steps below!
foreman start -f Procfile.static
Open a browser tab to http://localhost:3000 for the Rails app
example.
When you make changes, you have to refresh the browser page.

Installing rails on Ubuntu Bash Windows 10

I am using Windows 10 Insider built with Bash enabled. lsb_release shows its Ubuntu 14.04 LTS. So, I was wondering finally I can install RoR on Windows 10 and not use other installers. Because they say its Ubuntu on Windows.
I am following GoRails Guide by Chris Oliver to set RoR on Ubuntu 14.04 Win10. I tried both method using RVM & Rbenv but I ended up with errors
I also asked Chris to write a guide for this on his website and he thought it would be a great idea and but his only concern was opening up ports with Linux Software on Windows and connect to it
I am sure someone will soon find a way to install rails on Windows 10 but meanwhile I want to know if its possible or not? If yes what is it that I am doing wrong. Help me to fix it. Also what should I use for this RVM or RBENV. Which would be better in this case?
(Note: Please let me know if this looks like two different questions. I will edit it. I don't even know if its possible or not. Fixing errors is the later part.)
Here is rbenv error messages:
$ rbenv install 2.3.0
Downloading ruby-2.3.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...
BUILD FAILED (Ubuntu 14.04 using ruby-build 20160426-12-gf03f7f8)
Inspect or clean up the working tree at /tmp/ruby-build.20160513120821.313
Results logged to /tmp/ruby-build.20160513120821.313.log
Last 10 log lines:
rm -f ../../../.ext/x86_64-linux/io/wait.so *.o *.bak mkmf.log .*.time
rm -f Makefile extconf.h conftest.* mkmf.log
rm -f core ruby *~
rmdir --ignore-fail-on-non-empty -p 2> /dev/null || true
make[2]: Leaving directory `/tmp/ruby-build.20160513120821.313/ruby-2.3.0/ext/io/wait'
make[1]: Leaving directory `/tmp/ruby-build.20160513120821.313/ruby-2.3.0'
Generating RDoc documentation
./ruby is not found.
Try `make' first, then `make test', please.
make: *** [rdoc] Error 1
RVM error messages:
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...
BUILD FAILED (Ubuntu 14.04 using ruby-build 20160426-12-gf03f7f8)
Inspect or clean up the working tree at /tmp/ruby-build.20160513120821.313
Results logged to /tmp/ruby-build.20160513120821.313.log
Last 10 log lines:
rm -f ../../../.ext/x86_64-linux/io/wait.so *.o *.bak mkmf.log .*.time
rm -f Makefile extconf.h conftest.* mkmf.log
rm -f core ruby *~
rmdir --ignore-fail-on-non-empty -p 2> /dev/null || true
cooldudeabhi#ACERASPIRE:~$ rvm install 2.3.0
ruby-2.3.0 - #removing src/ruby-2.3.0..
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.3.0.ta r.bz2
Checking requirements for ubuntu.
Requirements installation successful.
df: Warning: cannot read table of mounted file systems: No such file or director y
ruby-2.3.0 - #configure
ruby-2.3.0 - #download
ruby-2.3.0 - #validate archive
cat: /dev/fd/63: No such file or directory
cat: /dev/fd/63: No such file or directory
The downloaded package for https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby -2.3.0.tar.bz2,
Does not contains single 'bin/ruby' or 'ruby-2.3.0',
Only '' were found instead.
Mounting remote ruby failed with status 4, trying to compile.
df: Warning: cannot read table of mounted file systems: No such file or director y
Checking requirements for ubuntu.
Requirements installation successful.
grep: write error: Broken pipe
sort: fflush failed: standard output: Broken pipe
sort: write error
Installing Ruby from source to: /home/cooldudeabhi/.rvm/rubies/ruby-2.3.0, this may take a while depending on your cpu(s)...
ruby-2.3.0 - #downloading ruby-2.3.0, this may take a while depending on your co nnection...
ruby-2.3.0 - #extracting ruby-2.3.0 to /home/cooldudeabhi/.rvm/src/ruby-2.3.0..rvm install 2.3.0
It appears it isn't possible as of build 14342, as this is an issue with Bash on Windows itself [1].
Some internal testing builds are reported to be able to install ruby via RVM, but it does not appear any of these builds are currently available to the 'fast' ring of Windows Insiders at this time [2].
Update: 2016-05-27
One step closer: Build 14352 was released on 2016-05-26 [3]. After running apt-get update && apt-get upgrade I was able to successfully install ruby-2.3.1 using both rvm and rbenv.
As noted in source #1 below, in order to fully utilize rvm I needed to run bash with /bin/bash --login. To achieve this I appended it to the Bash on Ubuntu on Windows shortcut's target field like this:
C:\Windows\System32\bash.exe -c "cd ~ && /bin/bash --login"
Now I can rvm use ruby-2.3.1 --default, gem install rails and rails new banana, however when bundler tries to run, there is an error:
dozers#DRAGONSTONE:~/banana$ bundle
--- ERROR REPORT TEMPLATE -------------------------------------------------------
...
Error details
ArgumentError: parent directory is world writable but not sticky
/home/dozers/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tmpdir.rb:93:in `ensure in mktmpdir'
/home/dozers/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tmpdir.rb:95:in `mktmpdir'
/home/dozers/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:29:in `update'
...
--- TEMPLATE END ----------------------------------------------------------------
Unfortunately, an unexpected error occurred, and Bundler cannot continue.
First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=parent+directory+is+world+writable+but+not+sticky&type=Issues
Update: 2016-06-03
The cat: /dev/fd/63: No such file or directory error is reported to be fixed in an upcoming Windows Insider release [4], but this doesn't seem to be fatal.
As a temporary workaround for the bundler error, issuing chmod -R +t ~/.bundle/cache appears to do the trick and now you have a working rails installation [5].
Sources:
https://github.com/Microsoft/BashOnWindows/issues/9#issuecomment-207978726
https://github.com/Microsoft/BashOnWindows/issues/222#issuecomment-214561156
https://blogs.windows.com/windowsexperience/2016/05/26/announcing-windows-10-insider-preview-build-14352/
https://github.com/Microsoft/BashOnWindows/issues/266#issuecomment-219576351
https://github.com/bundler/bundler/issues/4630#issuecomment-223576426

Internal Server Error while accessing newly installed Ruby on rails ( New App) on localhost:3000

I have completed installation of ROR, Rails.
When I tried starting the server using
rails s
/Users/xyz/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/app_rails_loader.rb:37: warning: Insecure world writable dir /usr/local/Cellar in PATH, mode 040777
/Users/xyz/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /usr/local/Cellar in PATH, mode 040777
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2013-09-20 06:19:14] INFO WEBrick 1.3.1
[2013-09-20 06:19:14] INFO ruby 2.0.0 (2013-05-14) [x86_64-darwin12.4.0]
[2013-09-20 06:19:14] INFO WEBrick::HTTPServer#start: pid=87245 port=3000
I tried accessing localhost:3000
But following error is appearing-
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, you#example.com and inform
them of the time the error occurred, and anything you might have done
that may have caused the error.
More information about this error may be available in the server error
log.
Output of brew doctor-
brew doctor Warning: Broken symlinks were found. Remove them with
brew prune: /usr/local/bin/unshadow /usr/local/bin/unique
/usr/local/bin/unafs /usr/local/bin/password.lst
/usr/local/bin/mailer /usr/local/bin/lanman.chr
/usr/local/bin/john.conf /usr/local/bin/john
/usr/local/bin/digits.chr /usr/local/bin/alpha.chr
/usr/local/bin/alnum.chr /usr/local/bin/all.chr
/usr/local/Library/LinkedKegs/john
Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked
can lead to build-trouble and cause brews that depend on those kegs to
fail to run properly once built. Run brew link on these:
aircrack-ng
mysql
Warning: You have uncommitted modifications to Homebrew If this a
surprise to you, then you should stash these modifications. Stashing
returns Homebrew to a pristine state but can be undone should you
later need to do so for some reason.
cd /usr/local/Library && git stash && git clean -d -f
Warning: Some installed formula are missing dependencies. You should
brew install the missing dependencies:
brew install freetype gmp libffi libpng libtool nettle p11-kit
Run brew missing for more details.
Warning: /usr/bin occurs before /usr/local/bin This means that
system-provided programs will be used instead of those provided by
Homebrew. The following tools exist at both paths:
certtool
easy_install
easy_install-2.6
git
git-cvsserver
git-receive-pack
git-shell
git-upload-archive
git-upload-pack
phar
phar.phar
php
php-config
phpize
tclsh
tclsh8.5
wish
wish8.5
Consider setting your PATH so that /usr/local/bin occurs before
/usr/bin. Here is a one-liner:
echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile You have new mail in /var/mail/gaurangagrawal
Run the commands that brew doctor listed one at a time:
brew prune
brew link aircrack-ng
brew link mysql
brew install freetype gmp libffi libpng libtool nettle p11-kit
it probably wouldn't hurt to update and upgrade:
brew update
brew upgrade
Use brew doctor again to see what's left.
The last complaint it has has to the with the order the directories in your $PATH are set. Use the one of off they provided (export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile) or go in there and take care of it manually.
One more thing, are you using macports? If so you'll need to remove it, it doesn't play nice with home brew. Use this link for more infomation: removing macports, step by step

Resources