SolvedCocoaPods pod lib create fails: uninitialized constant Nanaimo::Reader::StringScanner (NameError)

Before you start, are you using the CocoaPods beta release? No
a lot has changed with Xcode 8 that is not backwards compatible.

Xcode 8 Status: Only works with CocoaPods 1.1.0
Swift 3: You need to add a .swift-version file, see the CHANGELOG
China: Use https://gems.ruby-china.org/ instead of https://gems.ruby-china.org/ for the RC see #5910

Report

What did you do?

Ran pod lib create <name>

What did you expect to happen?

Create an initial pod library

What happened instead?

Sort of creates it, but doesn't fill in the name or any info I provided

➜  pod lib create test-lib
Cloning `https://github.com/CocoaPods/pod-template.git` into `test-lib`.
Configuring test-lib template.

------------------------------

To get you started we need to ask a few questions, this should only take a minute.

If this is your first time we recommend running through with the guide:
 - http://guides.cocoapods.org/making/using-pod-lib-create.html
 ( hold cmd and click links to open in a browser. )


What language do you want to use?? [ Swift / ObjC ]
 >
swift
Would you like to include a demo application with your library? [ Yes / No ]
 > No

Which testing frameworks will you use? [ Quick / None ]
 > None

Would you like to do view based testing? [ Yes / No ]
 > No
/Users/a/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/nanaimo-0.1.0/lib/nanaimo/reader.rb:61:in `initialize': uninitialized constant Nanaimo::Reader::StringScanner (NameError)
    from /Users/a/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/xcodeproj-1.4.0/lib/xcodeproj/plist.rb:27:in `new'
    from /Users/a/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/xcodeproj-1.4.0/lib/xcodeproj/plist.rb:27:in `read_from_path'
    from /Users/a/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/xcodeproj-1.4.0/lib/xcodeproj/project.rb:200:in `initialize_from_file'
    from /Users/a/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/xcodeproj-1.4.0/lib/xcodeproj/project.rb:102:in `open'
    from /Users/a/test-lib/setup/ProjectManipulator.rb:30:in `run'
    from /Users/a/test-lib/setup/ConfigureSwift.rb:49:in `perform'
    from /Users/a/test-lib/setup/ConfigureSwift.rb:7:in `perform'
    from /Users/a/test-lib/setup/TemplateConfigurator.rb:76:in `run'
    from ./configure:9:in `<main>'

To learn more about the template see `https://github.com/CocoaPods/pod-template.git`.
To learn more about creating a new pod, see `http://guides.cocoapods.org/making/making-a-cocoapod`.

Folder looks like:
image

Podspec looks like

#
# Be sure to run `pod lib lint ${POD_NAME}.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
  s.name             = '${POD_NAME}'
  s.version          = '0.1.0'
  s.summary          = 'A short description of ${POD_NAME}.'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!

  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'https://github.com/<GITHUB_USERNAME>/${POD_NAME}'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { '${USER_NAME}' => '${USER_EMAIL}' }
  s.source           = { :git => 'https://github.com/<GITHUB_USERNAME>/${POD_NAME}.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '8.0'

  s.source_files = '${POD_NAME}/Classes/**/*'

  # s.resource_bundles = {
  #   '${POD_NAME}' => ['${POD_NAME}/Assets/*.png']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
end

CocoaPods Environment

Stack

   CocoaPods : 1.1.1
        Ruby : ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin15]
    RubyGems : 2.6.7
        Host : Mac OS X 10.11.6 (15G1004)
       Xcode : 8.0 (8A218a)
         Git : git version 2.8.4 (Apple Git-73)
Ruby lib dir : /Users/a/.rbenv/versions/2.2.2/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ d30ee79362308df21fe8c0fcae753ead2468ae3d

Installation Source

Executable Path: /Users/a/.rbenv/versions/2.2.2/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.1.1
cocoapods-try         : 1.1.0
25 Answers

βœ”οΈAccepted Answer

gem uninstall nanaimo

It will prompt you for which version to uninstall πŸ‘

Other Answers:

Uninstalling nanaimo-0.2.2 did it for me. Now I only have nanaimo-0.2.3.

Had to explicitly remove the old nanaimo 0.1.0. Now it works

@MaximusMcCann Thanks! finally could do pod init now πŸ‘

Ran sudo gem update
And then reran above, but receiving related error .. :/

/Users/a/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/xcodeproj-1.4.0/lib/xcodeproj/plist.rb:23:in `read_from_path': cannot load such file -- nanaimo (LoadError)
    from /Users/a/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/xcodeproj-1.4.0/lib/xcodeproj/project.rb:200:in `initialize_from_file'
    from /Users/a/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/xcodeproj-1.4.0/lib/xcodeproj/project.rb:102:in `open'
    from /Users/a/test-lib/setup/ProjectManipulator.rb:30:in `run'
    from /Users/a/test-lib/setup/ConfigureSwift.rb:49:in `perform'
    from /Users/a/test-lib/setup/ConfigureSwift.rb:7:in `perform'
    from /Users/a/test-lib/setup/TemplateConfigurator.rb:76:in `run'
    from ./configure:9:in `<main>'
gem list | grep plist
plist (3.2.0, 3.1.0)
gem list | grep xcodeproj
xcodeproj (1.4.0, 1.3.3)

Any thoughts?

Appreciate the help!

More Issues: