Issues with starting a Rails project - ruby-on-rails

I decided to start a rails project. I went to the terminal and as usual typed in rails new blog. Instead of it completing I got this error
Installing nio4r 2.3.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/nio4r-2.3.1/ext/nio4r
C:/Ruby23-x64/bin/ruby.exe -r ./siteconf20181001-1392-69sdrh.rb extconf.rb
current directory: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/nio4r-2.3.1/ext/nio4r
make "DESTDIR=" clean
'make' is not recognized as an internal or external command,
operable program or batch file.
current directory: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/nio4r-2.3.1/ext/nio4r
make "DESTDIR="
'make' is not recognized as an internal or external command,
operable program or batch file.
make failed, exit code 1
Gem files will remain installed in
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/nio4r-2.3.1 for inspection.
Results logged to
C:/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/nio4r-2.3.1/gem_make.out
An error occurred while installing nio4r (2.3.1), and Bundler cannot continue.
Make sure that gem install nio4r -v '2.3.1' --source 'https://rubygems.org/'
succeeds before bundling.
In Gemfile:
rails was resolved to 5.2.1, which depends on
actioncable was resolved to 5.2.1, which depends on
nio4r
Now I did install the gem file nio4r version 2.3.1 and it installed successfully. but I still received the same error message. I do not know what is causing this.

Related

error on bundle install for sassc on cygwin

I am using Cygwin to on my windows machine to use RVM and run my rails project. Now when I run bundle install it is showing the following message.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/Shila/.rvm/gems/ruby-2.6.3/gems/sassc-2.2.1/ext
/home/Shila/.rvm/rubies/ruby-2.6.3/bin/ruby.exe -I /home/Shila/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200414-4993-go8jx2.rb extconf.rb
creating Makefile
current directory: /home/Shila/.rvm/gems/ruby-2.6.3/gems/sassc-2.2.1/ext
make "DESTDIR=" clean
current directory: /home/Shila/.rvm/gems/ruby-2.6.3/gems/sassc-2.2.1/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
CC: fatal error: cannot execute ‘cc1plus’: spawn: No such file or directory
compilation terminated.
make: *** [Makefile:236: ast.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/Shila/.rvm/gems/ruby-2.6.3/gems/sassc-2.2.1 for inspection.
Results logged to /home/Shila/.rvm/gems/ruby-2.6.3/extensions/x86_64-cygwin/2.6.0/sassc-2.2.1/gem_make.out
An error occurred while installing sassc (2.2.1), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.2.1' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
sass-rails was resolved to 6.0.0, which depends on
sassc-rails was resolved to 2.1.2, which depends on
sassc
ruby version is 2.6.3
Bundler version 1.17.3
I had to add new gcc-g++ and libgccpp1

How to fix ' Failed to build gem native extension' error with bootsnap with Windows

I am using Windows, and I just installed Ruby on Rails, ruby is version 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32], rails is version 6.0.0.
When running rails new blog (following this tutorial) bundle install runs.
I have tried reinstalling Ruby, changing its version, and even removing bootsnap and running something else, but even when trying to install the puma gem I get the same error.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/ext/bootsnap
C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/2.6.0 -r
./siteconf20191028-6188-1rw29js.rb extconf.rb
creating Makefile
current directory:
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/ext/bootsnap
make "DESTDIR=" clean
current directory:
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/ext/bootsnap
make "DESTDIR="
generating bootsnap-x64-mingw32.def
compiling bootsnap.c
linking shared-object bootsnap/bootsnap.so
C:/Ruby26-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
bootsnap.o:bootsnap.c:(.text+0x557): undefined reference to `__strcat_chk'
C:/Ruby26-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
bootsnap.o:bootsnap.c:(.text+0xa07): undefined reference to `__chk_fail'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:261: bootsnap.so] Error 1
make failed, exit code 2
Gem files will remain installed in
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5 for inspection.
Results logged to
C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/bootsnap-1.4.5/gem_make.out
An error occurred while installing bootsnap (1.4.5), and Bundler cannot
continue.
Make sure that `gem install bootsnap -v '1.4.5' --source
'https://rubygems.org/'` succeeds before bundling.
Actually, Bootsnap won't work on Windows anyway, so I'd recommend just removing it from Gemfile. If you want to leave it for production environment, perhaps you should include it conditionally with something like:
gem 'bootsnap' unless (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)

Mina deploy a rails project failed"Gem::Ext::BuildError: ERROR: Failed to build gem native extension."

I use the mina to deploy a rails web app,but always have many error.
This is part of my mina's logs
Using mini_magick (4.5.1)
Installing pg (0.18.4)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/www/sample_app/shared/bundle/ruby/2.3.0/gems/pg-0.18.4/ext
/usr/bin/ruby2.3 -r ./siteconf20160917-1997-acaacj.rb extconf.rb
Cannot allocate memory - /usr/bin/ruby2.3 -r ./siteconf20160917-1997-acaacj.rb extconf.rb 2>&1
Gem files will remain installed in /var/www/sample_app/tmp/build-14740431655892/vendor/bundle/ruby/2.3.0/gems/pg-0.18.4 for inspection.
Results logged to /var/www/sample_app/tmp/build-14740431655892/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.18.4/gem_make.out
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
! ERROR: Deploy failed.
-----> Cleaning up build
Unlinking current
OK
Connection to IP closed.
! Command failed.
Failed with status 1 (4864)
I noticed Cannot allocate memory but I use top keep watch on the memory,only use about 50%(total 1G),and I am already run gem install pg -v '0.18.4',install pg succeed. I can use gem listfind it.
How to fix it?Thanks

Rails bundle failing while installing atomic

I'm just getting into ruby on rails, And I'm setting it up on a second windows computer.
I've used the most recent 'railsinstaller' using rails: 4.0.0 and ruby: 2.0.0p195
when I run rails new <project name> Rails creates the project but fails on the bundle step with the following error.
Installing atomic (1.1.14)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
D:/RailsInstaller/Ruby2.0.0/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/atomic-1.1.14 for inspection.
Results logged to D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/gem_make.out
An error occurred while installing atomic (1.1.14), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.14'` succeeds before bundling.
I've tried a few things I've found on google such as updating gem and ruby but none of that worked... I'm too new to rails to figure this out myself, does anyone know what might be the problem?
EDIT
the outcome of gem install atomic -v '1.1.14'
D:\Programming\Ruby>gem install atomic -v '1.1.14'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ConEmu blocks ANSICON injection
The system cannot find the file D:\ansicon\ansicon-master\ansicon.exe.
ERROR: Error installing atomic:
ERROR: Failed to build gem native extension.
D:/RailsInstaller/Ruby2.0.0/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/atomic-1.1.14 for inspection.
Results logged to D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/gem_make.out
Thanks,
Peter McKinney

Error while creating rails new app project

Can't overcome problem. Everytime i generating new rails project on windows get the massage:
Installing json (1.6.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
C:/Ruby193/bin/ruby.exe: No such file or directory -- extconf.rb (LoadError)
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.6.5
for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.6.5/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.6.5), and Bundler cannot continue.
Make sure that `gem install json -v '1.6.5'` succeeds before bundling.
i've tried instal json but without lack... I've manage to instal json_pure. But still get this error. 'ruby dk.rb init' not worked too
For building native extensions on Windows, you need to install DevKit. It gives you a Unix-like environment and compilers.

Resources