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

Created on 29 Oct 2016  ยท  24Comments  ยท  Source: CocoaPods/CocoaPods

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

Most helpful comment

gem uninstall nanaimo

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

All 24 comments

@MaximusMcCann this was fixed in nanaimo 0.1.1, please run gem install nanaimo -v 0.1.2 then try again

Cheers!!

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!

@MaximusMcCann You shouldn't need sudo if you're using rbenv. Now it looks like nanaimo is not in your gem path?

what's the output of gem list | nanaimo?

hmm...

gem list | nanaimo
zsh: command not found: nanaimo

Please can you try gem install nanaimo -v 0.1.2 or use Bundler?

Looks like I must have set something up incorrectly to start :/

Had to refresh my shell

gem install nanaimo -v 0.1.2
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /Users/a/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/nanaimo-0.1.2/.gitignore

โžœ  sudo gem install nanaimo -v 0.1.2
Successfully installed nanaimo-0.1.2
Parsing documentation for nanaimo-0.1.2
Done installing documentation for nanaimo after 0 seconds
1 gem installed

โžœ  gem list | grep nanaimo
nanaimo (0.1.2, 0.1.0)

reloaded shell, but still `read_from_path': cannot load such file -- nanaimo (LoadError)

๐Ÿค” - I'm honestly not too sure. It looks like there's something funky with your ruby env. Could you try http://guides.cocoapods.org/using/a-gemfile.html?

Will try. Thank you for the help!

Got bundle to work. The key: cannot add a hyphen to the pod name so test-lib failed, but testLib works!

Still not working without bundle exec, but that's on me. Thanks @DanToml for the quick help!

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

@MaximusMcCann hi I've same problem. How to remove the old nanaimo?

gem uninstall nanaimo

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

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

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

Uninstalling nanaimo-0.2.2 did it for me. it work very well!

Install cocoa pods by this way.
sudo gem install -n /usr/local/bin cocoapods

Uninstalling nanaimo-0.2.2 did it for me too! Thanks!

sudo gem update worked for me :)

Uninstalling nanaimo-0.2.2 did it for me too! Thanks you!

I resolve this problem when i switch ruby version 2.1.1 to 2.2.4

Uninstalling old versions of Nanaimo worked!

Probably your project file is corrupted try to use https://github.com/Karumi/Kin to figure it out

$ gem uninstall nanaimo

Select gem to uninstall:
 1. nanaimo-0.2.3
 2. nanaimo-0.2.4
 3. nanaimo-0.2.5
 4. All versions

Uninstalled 0.2.3 and 0.2.5. Worked for me. Maybe having more than one version triggers the issue? Dunno.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

steffendsommer picture steffendsommer  ยท  3Comments

Mingmingmew picture Mingmingmew  ยท  3Comments

luhui picture luhui  ยท  3Comments

marzapower picture marzapower  ยท  3Comments

pallaviMN picture pallaviMN  ยท  3Comments