Open grvsachdeva opened 5 years ago
I am also receiving similar error. Thanks for posting Gaurav.
On Thu, Mar 7, 2019, 9:24 PM Gaurav Sachdeva notifications@github.com wrote:
Hi!
I updated my local master, ran bundle install and got the below error on running rails s
[image: mysql2_error] https://user-images.githubusercontent.com/20878070/53969213-60c72900-411e-11e9-8841-ee7126c55ff7.png
I also ran bundle install --without production mysql after deleting Gemfile.lock but got same error.
Solution which worked for me:
I added gem 'activerecord-mysql2-adapter' to the gemfile, deleted Gemfile.lock, ran bundle install, ran rails s and error gone.
Here's a snippet from Gemfile
[image: gemfile] https://user-images.githubusercontent.com/20878070/53969507-ee0a7d80-411e-11e9-8b46-277b00f09239.png
which states running bundle install --without production mysql should not require need to include the activerecord-mysql2-adapter but it didn't worked.
Any idea @jywarren https://github.com/jywarren @siaw23 https://github.com/siaw23 @publiclab/reviewers https://github.com/orgs/publiclab/teams/reviewers @publiclab/plots2-reviewers https://github.com/orgs/publiclab/teams/plots2-reviewers?
@siddhishree https://github.com/siddhishree has also reported the same error in the Gitter channel:
I've been trying to setup local plots2 development environment while follwing https://github.com/publiclab/plots2#installation, and while on step 7 I face issue https://pastebin.com/AbL6a7Cw, I tried installing mysql2 on gem but no changes, I'm a bit inexperienced in ruby, so if anyone can help
— You are receiving this because you are on a team that was mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/4936, or mute the thread https://github.com/notifications/unsubscribe-auth/AUACQ4pLQHHt60FE6aLHz4Scj-kfnXgjks5vUTYdgaJpZM4bjhXr .
You can add gem 'activerecord-mysql2-adapter' to Gemfile @SidharthBansal as a temporary fix. Let's see what others think about this fix. Thanks!
Application is configured to use Passenger. So instead of rails s
to start the server you should be running passenger start
instead. That way you don't need gem 'activerecord-mysql2-adapter'
in the Gemfile.
I followed your method for temp fix but the error isn't gone.
Application is configured to use Passenger. So instead of rails s to start the server you should be running passenger start instead. That way you don't need gem 'activerecord-mysql2-adapter' in the Gemfile.
Ah, although I prefer to use Webrick as for development it has been sufficient for me and haven't thrown such error. I also tried passenger but same error
@gauravano While doing rake:db: setup
. It's showing the same error even after adding gem 'activerecord-mysql2-adapter'
in Gemfile and deleting lock file and running install bundle
.
There's a bunch of solutions here. I haven't taken time to look into this as I'd have to first but I'm sure the SO thread should have a at least one fix for this that you can try.
Got the same error about two days ago after pulling master. I normally use sqlite3 . Adding gem 'mysql2', '>= 0.4.4'
on the list of main gems removed the error for me. Not a smart fix though.
@cesswairimu i've had 'mysql2', '>= 0.4.4'
in the main gem list from the start but don't check it in. That's the main reason I was trying to push for a one-DB system. It's like to work with the project like this...at least for me.
Aha! I see do u use mysql as your local db and if so were you getting this error @siaw23 ?
I've never seen this error before. Everything works fine for me except the hustle of having to juggle different db systems. So I use mysql (MariaDB variant) for this project and all is fine.
I seem to remember (but am not sure of it) some PR that may have changed the gemfile's mysql setup recently. I feel like i look at a lot of PRs so I could be mixed up with MapKnitter.
But also it's hard to skim the changes to the Gemfile now because dependabot is helping us update it all the time. Is there a quick commandline way to skim all the diffs to the Gemfile to look for "mysql" and see if anything's changed in the past month or so?
https://github.com/publiclab/plots2/commits/master/Gemfile
On Thu, Mar 7, 2019 at 12:57 PM Cess notifications@github.com wrote:
Got the same error about two days ago after pulling master. I normally use sqlite3 . Adding gem 'mysql2', '>= 0.4.4' on the list of main gems removed the error for me. Not a smart fix though.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/4936#issuecomment-470629456, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ239RLdmBQQn-m2-GumqGVQWMoR6ks5vUVLtgaJpZM4bjhXr .
@siaw23 @cesswairimu I did the same as both of you for a bit and then got rid of it somehow just need to remember exactly what I did! Try putting it back into production, removing activerecord-mysql2-adapter (maybe even uninstall it from the CLI) and deleting the .bundle folder rm -r .bundle
and running bundle install
again.
@siaw23 I only use rails s
and I avoid activerecord-mysql2-adapter
completely so I don't know if it has to do with that but I could be wrong it gets difficult to keep track of exactly whats running when.
can someone possibly check if they get it in mapknitter too just to see if its plots2 specific? I may have gotten it and then fixed it there too. I have a pending PR for a mysql update there so I would want to note this issue there
@jywarren I use the vscode extension GitLens it lets you scroll through the file history of any file going months back. There haven't been any recent changes to mysql in the gemfile
I use Git blame for checking the history of a file. Works good for me. As Sasha mentioned, there's no change - https://github.com/publiclab/plots2/blame/1678b22d17a6bca4f4320e4efaa79df979ded005/Gemfile#L78
Anyway, I am working by adding activerecord-mysql-adapter for now. I will give try to @siaw23's link, @cesswairimu approach and @sashadev-sky's approach soon.
Thanks all!
I ran into this problem when setting up the repo on my system using sqlite. I tried tracing it to get more details and saw the error Mysql2::Error: The used table type doesn't support FULLTEXT indexes
. Tracing that further led me to db/schema.rb:58
:
add_index "comments", ["comment"], name: "index_comments_on_comment", type: :fulltext if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
I traced the error further and got to the file config/initializers/abstract_mysql2_adapter.rb
. When I commented out the contents of this file and ran rake db:setup
again, everything worked fine.
I can raise a PR to fix this, @gauravano.
Folks are still experiencing this so I'm re-opening and we should try to:
Thanks all, for helping to figure this out! If you can leave a comment here please note as many of these as you can:
Thank you!!!
OK so the core issue we're focusing on is "mysql2 is not part of bundle" error while running rails server
-- which also can occur when running passenger start
. If you have a different error or a different but similar variation of this, please let us know with some details!
This does not affect GitPod, so a quick fix is to use GitPod (as in the README) as a workaround.
This has especially affected folks running the app locally. I suspect it may relate to mysql installation on different OS or architectures, or mysql dev files being installed.
I'll start compiling solutions people have tried, and will number them. We'll try to track which have worked for more people, and perhaps see patterns emerge as we get more info from people.
https://github.com/publiclab/plots2/pull/4984/files (runs require 'active_record/connection_adapters/mysql2_adapter'
only if ActiveRecord::Base.connection.adapter_name == "Mysql2"
Some people bypassed by using passenger start
or the simple webrick server with rails server webrick
Adding gem 'activerecord-mysql2-adapter'
to Gemfile
Adding gem 'mysql2', '>= 0.4.4'
on the list of main gems in the Gemfile (i.e. outside group :mysql, :production do
) (supported by this post saying "make sure that the gem is not placed inside a group statement in your Gemfile") - basically moving that line outside of this block
on debian or ubuntu try sudo apt-get install libmysqlclient-dev
and then run bundle install
again
Downgrading to gem 'mysql2', '~=0.3.2'
or lower -- Historically we had kept mysql gem below v0.4.3
because, according to this note, 0.4.3+ causes a version mismatch, apparently, and demands 'activerecord-mysql2-adapter'
-- however, probably due to Dependabot, we eventually went past that to now having v0.5.3
-- since Nov 28, 2019; see Gemfile.lock
Note: this page says:
"It's currently an issue with Rails 4.1.x and 4.2.x, per this bug report, it will be fixed in the next release of rails 4.2.x (credit to dcorr in comments for the link).
But many are experiencing it on Rails 5 now.
tl;dr I aborted the process of setting up mysql
as my database (reasons below), but was still unable to setup the environment due to ???
I do want to preface that my original issue was installing rvm
on my Mac w/zsh - it was a tangled mess due to cacertificates
and hidden files. I finally found a quick fix so please reach out to me if you're experiencing the same.
It is at (and due to) the following point I decided to abort setting up mysql2 as my database in favor of sqlite3.
Reason 1: The The TESTING.md, here, reads that
In development and test environments, the project uses SQLite3, but in production it uses MySQL (or mariadb).
Thus, I deemed utilizing mysql2 unnecessary for my own purposes.
aside - perhaps we can reduce the mysql setup errors simply by including the directive only in the TESTING.md and inking to it from the publiclab/plots2 README.md (?)
Reason 2: The same document shows what the config/database.yml file should be after following the configuration steps: Mine was:
After configuring sqlite3,
cp config/database.yml.sqlite.example config/database.yml
,
rake db:setup
worked.
I did first comment out the mysql group directive in the Gemfile,
group :mysql, :production, :development, :test do
gem 'mysql2', '>= 0.4.4'
# mysql 0.4.3+ causes a version mismatch, apparently, and demands 'activerecord-mysql2-adapter'
end
At the next step in the process I RECIEVED AN ERROR and am reaching out for direction. (this might need to be discussed elsewhere as it does not pertain to the thread)
manifest.js
file. I was unable to edit the file as I am unfamiliar with sprockets and a simple copy/paste is not allowable. The linked instructions specifically state that it needs to be configured properly. Per these instructions, I was also unable to verify that our application.html.erb file(s) has the javascript_include_tag
. . .The created file, as opened in the web, contains: as opposed to the instructions:
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
rails webpacker:install && rails webpacker:install:react && rails generate react:install
, I received the following error:
Please see here for the full log.
Thanks in advance for any information/advice you may have to help me get set up. Please let me know if I can provide any further information. In the meantime, I'll ensure I'm familiar with the ins/outs of GitPod. Happy coding, everybody!
Hi @stephaniequintana this is really helpful and thorough note taking, thank you. In sqlite, are you able to run everything normally in development mode, or are you not yet sure of that? We used to use sqlite in development more often, but over time we began using more mysql features such as fulltext searching. However, I believe at least some of those features are isolated with conditionals; this is not super ideal but it works:
That means full text search doesn't work in sqlite but most other things should, i believe.
But, to your specific issues now:
git config --global url."https://github.com/".insteadOf ssh://git@github.com/
and then re-running the webpacker command?Again, thank you! This last issue especially is new and we're working to smooth out the install process given the difficulties. Did you mention btw that you wanted a local copy to be able to run tests? I /believe/ tests will run in gitpod, won't they? Not sure but would be good to know if not. Thank you!!!
@jywarren To clarify, I wanted to set up my local environment because I thought it was a necessary step in being able to contribute (partly due to link by the welcomebot from my initial PR). Even after learning about GitPod, I was resolved to work through the setup errors, a personal faux pa of determination. Please, do not concentrate any further efforts on getting my personal local environment up and running. I'm glad to be able to gain experience with GitPod.
That said, I would like to help in any way that I can. Please let me know if you would like me to run setup commands or send error logs...
In reference to the above questions, I did not get far enough through the process to see if I could run everything in development mode. I did run git config --global url."https://github.com/".insteadOf ssh://git@github.com/
followed by the webpacker command. It did not solve my issue, here is the error log for your viewing. For fun, I ran passenger start
and the following is what http://localhost:3000/
shows:
I feel as though I opened a few cans of worms for you all, my apologies. Again, I would like to help in any way that I can, please feel free to let me know if or how I might be able to.
No worries @stephaniequintana it's very helpful to know of these barriers in our install process. I'm going to follow up with the question "is this webpack step necessary for local development" and I think i can research that question.
I found from your very helpful log that the webpack step runs yarn
which is why it results in a similar error:
Updating webpack paths to include .jsx file extension
File unchanged! The supplied flag value not found! config/webpacker.yml
Installing all react dependencies
run yarn add react react-dom @babel/preset-react prop-types babel-plugin-transform-react-remove-prop-types from "."
yarn add v1.22.18
[1/4] 🔍 Resolving packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads git://github.com/jywarren/grow.git
Directory: /Users/stephaniequintana/Desktop/plots2
Output:
fatal: remote error:
The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
I'll have to see why the forced protocol change didn't help, but it's very useful info for addressing https://github.com/publiclab/plots2/issues/10827
Also @stephaniequintana i wanted to point out that I found the webpack steps were not necessary in installation -- see details at https://github.com/publiclab/plots2/issues/10828 but basically the cause of these errors was https://github.com/publiclab/plots2/issues/10827, and once we solve that completely we shouldn't see the webpack error again!
@jywarren - Thank you for sharing that with me, it absolutely made my day! ...and reading through those comments is like watching rocket surgery (yes, rocket surgery!) - KUDOS to you and @Forchapeatl 🥳 I have now developed knowledge envy.
Hi!
I updated my local master, ran
bundle install
and got the below error on runningrails s
I also ran
bundle install --without production mysql
after deleting Gemfile.lock but got same error.Solution which worked for me:
I added gem 'activerecord-mysql2-adapter' to the gemfile, deleted Gemfile.lock, ran
bundle install
, ranrails s
and error gone.Here's a snippet from Gemfile
which states running
bundle install --without production mysql
should not require need to include the activerecord-mysql2-adapter but it didn't worked.Any idea @jywarren @siaw23 @publiclab/reviewers @publiclab/plots2-reviewers?
@siddhishree has also reported the same error in the Gitter channel: