gpt4 book ai didi

ruby - 安装 gem 时无法将 "\x89"从 ASCII-8BIT 转换为 UTF-8 xxx

转载 作者:太空宇宙 更新时间:2023-11-03 16:23:20 26 4
gpt4 key购买 nike

我目前正在编写一个 gem,由于某些原因需要包含 WordPress 的完整副本(不完全确定这是否相关)。现在,问题;运行 gem 构建正常,但 gem install 给出此错误消息似乎是针对每个二进制文件(.gif、.png 等),并且在出现一些错误后,进程停止。

unable to convert "\x89" from ASCII-8BIT to UTF-8 xxx/xxx.xx

某些消息的“x89”标识符不同。

这是一个例子

unable to convert "\xF2" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/spinner.gif, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/stars-2x.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/stars.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/w-logo-blue.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/w-logo-white.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wheel.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wordpress-logo.png, skipping
unable to convert "\xF7" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wpspin_light-2x.gif, skipping
unable to convert "\xF5" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wpspin_light.gif, skipping
unable to convert "\xF6" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/xit-2x.gif, skipping
unable to convert "\xF3" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/xit.gif, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/yes.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/plugins/akismet/_inc/img/logo-full-2x.png, skipping
unable to convert "\xE8" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfifteen/genericons/Genericons.eot, skipping
unable to convert "\xFC" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfifteen/genericons/Genericons.woff, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfifteen/screenshot.png, skipping
unable to convert "\x80" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfourteen/genericons/Genericons-Regular.otf, skipping

我在进程停止前得到的最后一行是

unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-includes/js/mediaelement/bigplay.png, skipping

我在其他地方看到过类似的问题,但在尝试安装时它们都是针对特定 gem 的。我想问的是如何修复我的 gem 以便不产生此错误?

这是我的 gem 规范

require File.expand_path(File.dirname(__FILE__)) + '/lib/gemname.rb'

Gem::Specification.new do |s|
s.name = 'gemname'
s.version = Gemname::VERSION
s.executables << 'gemname'
s.licenses = ['LICENSE']
s.summary = "Short description"
s.description = "Long description"
s.authors = ["Sigurd Berg Svela"]
s.email = 'sigurdbergsvela@gmail.com'
s.files = `git ls-files -- lib/*`.split("\n")
s.homepage = 'https://github.com/sigurdsvela/gemname'
s.required_ruby_version = '>= 2.0.0'

gemRootDir = File.dirname(File.expand_path(__FILE__))

# get an array of submodule dirs by executing 'pwd' inside each submodule
`git submodule --quiet foreach pwd`.split("\n").each do |submodule_path|

# for each submodule, change working directory to that submodule
Dir.chdir(submodule_path) do

# issue git ls-files in submodule's directory
submodule_files = `git ls-files`.split("\n")

# prepend the submodule path to create absolute file paths
submodule_files_fullpaths = submodule_files.map do |filename|
"#{submodule_path}/#{filename}"
end

# remove leading path parts to get paths relative to the gem's root dir
# (this assumes, that the gemspec resides in the gem's root dir)
submodule_files_paths = submodule_files_fullpaths.map do |filename|
filename.gsub "#{gemRootDir}/", ""
end

# add relative paths to gem.files
s.files += submodule_files_paths
end

end

# Hardcode include gitignores submodule
Dir.chdir(Boot.dir + "/templates/gitignores") do
submodule_path = Boot.dir + "/templates/gitignores"

# issue git ls-files in submodule's directory
submodule_files = `git ls-files`.split("\n")

# prepend the submodule path to create absolute file paths
submodule_files_fullpaths = submodule_files.map do |filename|
"#{submodule_path}/#{filename}"
end

# remove leading path parts to get paths relative to the gem's root dir
# (this assumes, that the gemspec resides in the gem's root dir)
submodule_files_paths = submodule_files_fullpaths.map do |filename|
filename.gsub "#{gemRootDir}/", ""
end

# add relative paths to gem.files
s.files += submodule_files_paths
end

end

最佳答案

这似乎是 gem 安装程序的错误。但是“gem install germane --no-document”是一个临时解决方案。

关于ruby - 安装 gem 时无法将 "\x89"从 ASCII-8BIT 转换为 UTF-8 xxx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29899578/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com