Cannot install bundler & gems in the Requirement : Failed to build gem native extension

Hi Kevin,

I’m having trouble trying to set up the environment in the last couple days. So far, I am stuck in the installation of gems when installing the Requirement (Failed to build gem native extension.), and I also cannot install the Configuration Files. I have read through the previous related posts and the threads on stack-overflow and still have no idea how to solve it. I have attached the whole installation quotes below.

I really want to start working on the Alpha course as soon as possible, is it possible to setup a Google Hangout with you or your colleague to help walk me through the setup? I am available any time. Thanks for your help.

Best,
Chris

> chrismac17s-MacBook-Pro:~ chrismac17$ ~/.dotfiles/bin/install_requirements
> install_requirements: Installing Homebrew...
> install_requirements: Press enter to continue.
> install_requirements: Hombrew already installed. Updating...
> Updated 1 tap (homebrew/core).
> ==> Updated Formulae
> consul-template            libgcrypt                  nodeenv
> gofabric8                  node                       rkhunter
> install_requirements: Hombrew updated.
> install_requirements: Installing Brew formulae...
> install_requirements: Press enter to continue.
> Updating Homebrew...
> Warning: git 2.13.2 is already installed
> Warning: heroku 6.11.14 is already installed
> Warning: qt 5.9.0_1 is already installed
> Warning: rbenv 1.1.1 is already installed
> Warning: ruby-build 20170523 is already installed
> install_requirements: Upgrading outdated brew formulae...
> Updating Homebrew...
> Error: git 2.13.2 already installed
> Error: heroku 6.11.14 already installed
> Error: qt5 5.9.0_1 already installed
> Error: rbenv 1.1.1 already installed
> Error: ruby-build 20170523 already installed
> install_requirements: Brew formulae installed.
> install_requirements: Installing Ruby...
> install_requirements: Press enter to continue.
> install_requirements: Ruby v2.3.1 already installed.
> install_requirements: Ruby v2.3.1 set as default version.
> install_requirements: Installing bundler and gems...
> install_requirements: Press enter to continue.
> Successfully installed bundler-1.15.1
> Parsing documentation for bundler-1.15.1
> Done installing documentation for bundler after 3 seconds
> 1 gem installed
> Fetching gem metadata from https://rubygems.org/........
> Fetching version metadata from https://rubygems.org/..
> Fetching dependency metadata from https://rubygems.org/.
> Resolving dependencies...
> Using rake 12.0.0
> Using public_suffix 2.0.5
> Using byebug 9.0.6
> Fetching pg 0.21.0
> Installing pg 0.21.0 with native extensions
> Using coderay 1.1.1
> Using method_source 0.8.2
> Using slop 3.6.0
> Using concurrent-ruby 1.0.5
> Using i18n 0.8.4
> Using minitest 5.10.2
> Using thread_safe 0.3.6
> Using builder 3.2.3
> Using erubis 2.7.0
> Using mini_portile2 2.2.0
> Using rack 2.0.3
> Using nio4r 2.1.0
> Using websocket-extensions 0.1.2
> Using mime-types-data 3.2016.0521
> Using arel 7.1.4
> Using bundler 1.15.1
> Using thor 0.19.4
> Using unf_ext 0.0.7.4
> Using netrc 0.11.0
> Using rspec-support 3.6.0
> Using diff-lcs 1.3
> Using parallel 1.11.2
> Using ast 2.3.0
> Using powerpack 0.1.1
> Using ruby-progressbar 1.8.1
> Using unicode-display_width 1.3.0
> Using sqlite3 1.3.13
> Using rainbow 2.2.2
> Using addressable 2.5.1
> Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
>     current directory: /Users/chrismac17/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.21.0/ext
> /Users/chrismac17/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170629-4534-1ptq4gn.rb extconf.rb
> checking for pg_config... no
> No pg_config... trying anyway. If building fails, please try again with
>  --with-pg-config=/path/to/pg_config
> checking for libpq-fe.h... no
> Can't find the 'libpq-fe.h header
> *** extconf.rb failed ***
> Could not create Makefile due to some reason, probably lack of necessary
> libraries and/or headers.  Check the mkmf.log file for more details.  You may
> need configuration options.
> Provided configuration options:
> 	--with-opt-dir
> 	--without-opt-dir
> 	--with-opt-include
> 	--without-opt-include=${opt-dir}/include
> 	--with-opt-lib
> 	--without-opt-lib=${opt-dir}/lib
> 	--with-make-prog
> 	--without-make-prog
> 	--srcdir=.
> 	--curdir
> 	--ruby=/Users/chrismac17/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME)
> 	--with-pg
> 	--without-pg
> 	--enable-windows-cross
> 	--disable-windows-cross
> 	--with-pg-config
> 	--without-pg-config
> 	--with-pg_config
> 	--without-pg_config
> 	--with-pg-dir
> 	--without-pg-dir
> 	--with-pg-include
> 	--without-pg-include=${pg-dir}/include
> 	--with-pg-lib
> 	--without-pg-lib=${pg-dir}/lib
> To see why this extension failed to compile, please check the mkmf.log which can be found here:
> /Users/chrismac17/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-16/2.3.0-static/pg-0.21.0/mkmf.log
> extconf failed, exit code 1
> Gem files will remain installed in /Users/chrismac17/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.21.0
> for inspection.
> Results logged to
> /Users/chrismac17/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-16/2.3.0-static/pg-0.21.0/gem_make.out
> An error occurred while installing pg (0.21.0), and Bundler cannot continue.
> Make sure that `gem install pg -v '0.21.0'` succeeds before bundling.
> In Gemfile:
>   pg
> install_requirements: Gems installed
> install_requirements: Installing Git completion...
> install_requirements: Press enter to continue.
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                  Dload  Upload   Total   Spent    Left  Speed
> 100 70858  100 70858    0     0   7482      0  0:00:09  0:00:09 --:--:--  8933
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                  Dload  Upload   Total   Spent    Left  Speed
> 100 16223  100 16223    0     0   3611      0  0:00:04  0:00:04 --:--:--  3612
> install_requirements: Git completion installed.
> install_requirements: Installing NVM...
> install_requirements: Press enter to continue.
> install_requirements: NVM already installed.
> install_requirements: Activating NVM...
> install_requirements: NVM Activated.
> install_requirements: Installing Node...
> install_requirements: Press enter to continue.
> install_requirements: Node v6.10.1 already installed.
> install_requirements: Installing node packages...
> install_requirements: Press enter to continue.
> /Users/chrismac17/.nvm/versions/node/v6.10.1/bin/eslint -> /Users/chrismac17/.nvm/versions/node/v6.10.1/lib/node_modules/eslint/bin/eslint.js
> /Users/chrismac17/.nvm/versions/node/v6.10.1/bin/json -> /Users/chrismac17/.nvm/versions/node/v6.10.1/lib/node_modules/json/lib/json.js
> /Users/chrismac17/.nvm/versions/node/v6.10.1/bin/node-debug -> /Users/chrismac17/.nvm/versions/node/v6.10.1/lib/node_modules/node-inspector/bin/node-debug.js
> /Users/chrismac17/.nvm/versions/node/v6.10.1/bin/node-inspector -> /Users/chrismac17/.nvm/versions/node/v6.10.1/lib/node_modules/node-inspector/bin/inspector.js
> /Users/chrismac17/.nvm/versions/node/v6.10.1/bin/phantomjs -> /Users/chrismac17/.nvm/versions/node/v6.10.1/lib/node_modules/phantomjs-prebuilt/bin/phantomjs
> /Users/chrismac17/.nvm/versions/node/v6.10.1/bin/webpack -> /Users/chrismac17/.nvm/versions/node/v6.10.1/lib/node_modules/webpack/bin/webpack.js
> > phantomjs-prebuilt@2.1.14 install /Users/chrismac17/.nvm/versions/node/v6.10.1/lib/node_modules/phantomjs-prebuilt
> > node install.js
> Considering PhantomJS found at /Users/chrismac17/.nvm/versions/node/v6.10.1/bin/phantomjs
> Looks like an `npm install -g`
> Could not link global install, skipping...
> Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-macosx.zip
> Saving to /var/folders/0v/003055n51wxby4hv2w4j3ltm0000gn/T/phantomjs/phantomjs-2.1.1-macosx.zip
> Receiving...
> Error making request.
> Error: connect ETIMEDOUT 54.231.83.3:443
>     at Object.exports._errnoException (util.js:1018:11)
>     at exports._exceptionWithHostPort (util.js:1041:20)
>     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
> Please report this full log at https://github.com/Medium/phantomjs
> /Users/chrismac17/.nvm/versions/node/v6.10.1/lib
> ├── eslint@4.1.1 
> ├── json@9.0.6 
> ├── node-inspector@1.1.1 
> ├── webpack@3.0.0 
> ├── ws@3.0.0 
> └── xt@0.3.3 
> npm ERR! Darwin 16.6.0
> npm ERR! argv "/Users/chrismac17/.nvm/versions/node/v6.10.1/bin/node" "/Users/chrismac17/.nvm/versions/node/v6.10.1/bin/npm" "install" "-g" "xt" "eslint" "json" "node-inspector" "phantomjs-prebuilt" "webpack" "ws"
> npm ERR! node v6.10.1
> npm ERR! npm  v3.10.10
> npm ERR! code ELIFECYCLE
> npm ERR! phantomjs-prebuilt@2.1.14 install: `node install.js`
> npm ERR! Exit status 1
> npm ERR! 
> npm ERR! Failed at the phantomjs-prebuilt@2.1.14 install script 'node install.js'.
> npm ERR! Make sure you have the latest version of node.js and npm installed.
> npm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,
> npm ERR! not with npm itself.
> npm ERR! Tell the author that this fails on your system:
> npm ERR!     node install.js
> npm ERR! You can get information on how to open an issue for this project with:
> npm ERR!     npm bugs phantomjs-prebuilt
> npm ERR! Or if that isn't available, you can get their info via:
> npm ERR!     npm owner ls phantomjs-prebuilt
> npm ERR! There is likely additional logging output above.
> npm ERR! Please include the following file with any support request:
> npm ERR!     /Users/chrismac17/.dotfiles/requirements/npm-debug.log
> install_requirements: Node packages installed.
> install_requirements: Installing atom packages...
> install_requirements: Press enter to continue.
> Installing linter to /Users/chrismac17/.atom/packages ✓
> Installing linter-eslint to /Users/chrismac17/.atom/packages ✓
> Installing linter-rubocop to /Users/chrismac17/.atom/packages ✓
> Installing react to /Users/chrismac17/.atom/packages ✓
> Installing rspec to /Users/chrismac17/.atom/packages ✓
> install_requirements: Atom packages installed.
> install_requirements: done.
> chrismac17s-MacBook-Pro:~ chrismac17$ 
> chrismac17s-MacBook-Pro:~ chrismac17$ 
> chrismac17s-MacBook-Pro:~ chrismac17$ ~/.dotfiles/bin/install_dotfiles
> (erb):21:in ``': No such file or directory - npm (Errno::ENOENT)
> 	from (erb):21:in `text'
> 	from /Users/chrismac17/.rbenv/versions/2.3.1/lib/ruby/2.3.0/erb.rb:864:in `eval'
> 	from /Users/chrismac17/.rbenv/versions/2.3.1/lib/ruby/2.3.0/erb.rb:864:in `result'
> 	from /Users/chrismac17/.dotfiles/bin/.install_dotfiles.rb:43:in `text'
> 	from /Users/chrismac17/.dotfiles/bin/.install_dotfiles.rb:74:in `compile_diff'
> 	from /Users/chrismac17/.dotfiles/bin/.install_dotfiles.rb:47:in `diff'
> 	from /Users/chrismac17/.dotfiles/bin/.install_dotfiles.rb:51:in `changed?'
> 	from /Users/chrismac17/.dotfiles/bin/.install_dotfiles.rb:121:in `select'
> 	from /Users/chrismac17/.dotfiles/bin/.install_dotfiles.rb:121:in `main'
> 	from /Users/chrismac17/.dotfiles/bin/.install_dotfiles.rb:162:in `<main>'
> chrismac17s-MacBook-Pro:~ chrismac17$

List item

Hey, I hope you’re able to get the help you need. I had a lot of trouble with the Enviroment setup and this post (dotfiles error) : (erb):32: command not found: npm get prefix and a post that I link to in that discourse helped me a lot. Try giving it a shot and seeing if it helps you.

Thanks a lot for the post, I will give it a try.

Hey sorry I haven’t had time to respond sooner. If you can run ruby and rspec when working on the projects then you will be good to go for the alpha curriculum! We can fix the rest on day 1.

Check to see if you can continue through this alpha course online because the pg gem is for postgres, used only when we learn to connect our apps with a database in the main course. NVM stands for node version manager which is for the javascript portion of the bootcamp. Let me know :smile: