问题
When I type
pods install
or
pods update
I get the following for one library:
Unable to read the license file /Users/me/Documents/project/myproject/company/myproduct/Pods/OHAttributedLabel/OHAttributedLabel/LICENSE
for the spec OHAttributedLabel (3.5.3)
Does anyone know why? I have been suggested:
pod repo remove master
pod setup
to no avail
回答1:
TL;DR It's Ruby 2.2.+ in OS X. Go back to Ruby 2.1.6.
This was my problem.
[!] Unable to read the license file '.../LICENSE_.txt' for the spec 'pod (v.v.v)'
But also had the problem in Rails.
I had the same problem last week. And Rails had the same problem with load paths with Capital letters in the file path.
This is the question and their response. Strange error in rails - missing helper
This is the issue on Github https://github.com/rails/rails/issues/18660
So, i thought there is the same problem. I go back and the cocoa pod CLI copied all the Licenses in acknowledges.
In fact, we should post an issue on cocoa pods github.
回答2:
I just had this issue today, seems to have been caused by my cache being corrupted somehow; perhaps a charset issue? No idea, but the solution that worked for me was the bash script in this Gist.
It clears the cocoapods cache so that you get a fresh copy of all required when you next run pod install
. Fixed my problem immediately, confirming my suspicion, and hasn't reoccurred since.
回答3:
In my case this was related to someone in my team committing their .xcworkspace
file to the repository, which meant running pod install
gave me the licence warnings but at the same time, did not install my pods properly.
This is how I resolved it:
- First close Xcode.
- List item
- Delete the
Pods
folder from your project - Delete the
.xcworkspace
file, - Delete the
Podfile.lock
file - And then finally, for good measure delete the
DerivedData
folder
Now run pod install
and the issue should be fixed.
回答4:
My problem was that when I initially added the tag to git, the LICENSE file was not there. I fixed this by:
- Remove the tag from the git repo
- Make sure the LICENSE file has been committed to the git repo
- Add the tag to the git repo again
- run
pod cache clean --all
- run
pod spec lint
again
It should now work.
回答5:
In my case, the pods which complained about the LICENSE file didn't actually have a LICENSE file in their folders. My steps to fix this:
- Went to [project_name] -> Pods
- Opened a pod which already had a LICENSE file. Copied that file and pasted it inside the pod folder which is complaining.
- Found the complaining pod on cocoapods.org
- On the bottom of the page, there is written who owns the copyright (MIT, Apache, etc.)
- Click on the link that's in the
License
part, and you will be redirected to the page where you will find an example of a copyright statement. Copy and replace the old copyright from the file you have in the folder now. - In the
[year]
field check the latest when the pod was updated. - In the
[copyright owner]
use what's written on the pods page underAuthor
. - Save the file.
- run
pod install
in the terminal.
Use this image for reference.
回答6:
If I copy the old pod.lock from an old git branch over the latest git branch I no longer see 'pods is out of sync', and I don't have to redo 'pod update' 'pod install' again.
Someone in the team updated pods, and therefore the pods.lock file changed version the scribbly alphanumeric characters next to the libraries we use.
What's up with that though? Seriously if we update our libraries and then change to a different branch we'll need to update pods and rebuild - Is this the way the process is intended to be for pods and git?
回答7:
In my case, I solved this issue by changing the name of my license file from LICENSE to LICENSE.txt, updating the file name in the podspec, and including both the framework and the LICENSE.txt file in the zip file for my repository.
回答8:
run
pod deintegrate
then
pod cache clean --all
and
pod install
来源:https://stackoverflow.com/questions/24090178/how-to-fix-pods-license-file-error