我在Linux机器上安装了rvm,并从github下载了简单的项目。我尝试运行rails,但Ruby版本出错:
我执行了下一条命令:
当我打开项目并运行rails时,出现此错误
https://i.imgur.com/Dwvp8WF.png
我的Gemfile具有ruby 2.3.0
由于此错误https://imgur.com/a/UMcirdt,无法运行捆绑安装 w
哪个护栏,哪个红宝石:https://imgur.com/a/vycG8wG
答案 0 :(得分:1)
我没有使用rvm,但是我使用rbenv进行版本管理。
根据我的阅读,它的工作原理类似,尽管命令有些不同。
项目文件夹中的命令df1 = bind_rows(all_na_df, df1[,c('id', 'val')])
df1
# id val
# 1 a 0
# 2 b 1
# 3 b 2
# 4 b 2
# 5 b 3
# 6 c 2
# 7 c 3
是否生成了名为rvm use ruby-2.3.0
的文件?
它应该列出该项目中使用的红宝石的当前版本
答案 1 :(得分:0)
检查更新后的屏幕截图中的错误后,我认为最好这样做:
struct Welcome: Codable {
let data: JDDataClass?
let metaData: JDMetaData?
}
struct JDDataClass: Codable {
let team: [Team]?
let recruiterName, respondsQuickly: String?
}
struct Team: Codable {
let name, designation: String?
}
struct JDMetaData: Codable {
let sortOrder: [String]?
}
let multiLineString = """
{
"data": {
"team": [
{
"name": "XYZ",
"designation": "Managing director - South Asia"
},
{
"name": "XYZ",
"designation": "Managing director - South Asia"
}
],
"recruiterName": "Lorium Ipsem text",
"respondsQuickly": "1"
},
"metaData": {
"sortOrder": [
"respondsQuickly",
"recruiterName",
"team"
]
}
}
"""
extension Encodable {
subscript(key: String) -> Any? {
return dictionary[key]
}
var dictionary: [String: Any] {
return (try? JSONSerialization.jsonObject(with: JSONEncoder().encode(self))) as? [String: Any] ?? [:]
}
}
let decoder = JSONDecoder()
do {
if let data = multiLineString.data(using: String.Encoding.utf8, allowLossyConversion: false){
let json = try decoder.decode(Welcome.self, from: data)
var arrResult = [[String : Any]]()
if let sortOrder = json.metaData?.sortOrder {
for item in sortOrder {
if let data = json.data {
if let obj = data[item] {
arrResult.append([item: obj])
}
}
}
print(arrResult)
}
}
} catch {
print(error)
}
也许只是
rm -r ~/.bundle
bundle
bundle install
然后重试。
如果发生权限错误,请运行
rvm reinstall all
然后再做一次。