首页 > 解决方案 > rails的命令问题

问题描述

rails s命令在下面显示此问题;我不知道它是什么?这个项目使用运行良好;我也没有太大变化。

[vns@betito perseus]$ rails s
/usr/include/c++/8/bits/stl_vector.h:932: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = v8::Handle<v8::Value>; _Alloc = std::allocator<v8::Handle<v8::Value> >; std::vector<_Tp, _Alloc>::reference = v8::Handle<v8::Value>&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
Aborted (core dumped)

我的环境:

Fedora 28
ruby 2.5.1
rails 5.2.0
libg++ 8.1.1

奇怪的是我在另一个项目中执行了相同的命令,它运行得很好。

我错过了什么?

[vns@betito perseus]$ rails 
The most common rails commands are:
 generate     Generate new code (short-cut alias: "g")
 console      Start the Rails console (short-cut alias: "c")
 server       Start the Rails server (short-cut alias: "s")
 test         Run tests except system tests (short-cut alias: "t")
 test:system  Run system tests
 dbconsole    Start a console for the database specified in config/database.yml
              (short-cut alias: "db")

 new          Create a new Rails application. "rails new my_app" creates a
              new application called MyApp in "./my_app"


All commands can be run with -h (or --help) for more information.
In addition to those commands, there are:

/usr/include/c++/8/bits/stl_vector.h:932: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = v8::Handle<v8::Value>; _Alloc = std::allocator<v8::Handle<v8::Value> >; std::vector<_Tp, _Alloc>::reference = v8::Handle<v8::Value>&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
Aborted (core dumped)

如果我沿着它尝试命令,但它最终坏了。

标签: ruby-on-railsrubylinuxruby-on-rails-5

解决方案


似乎是这个' gem "less-rails" ';谢谢您的帮助

我删除了 gem,服务器运行正常;我必须检查是否有适用的旧版本。

该问题与Fedora 28 中默认打开的_GLIBCXX_ASSERTIONS编译标志有关;它会导致很多软件故障。

Fedora 28 维基

错误 1574797

更多更新:我发现了这个问题,它与 'therubyracer' 库有关。使用超出范围的向量存在错误。

到这一行:返回 &vector[0];

存档:ext/v8/rr.h#L223

所以现在 libstdc++ 8.1 正在检查断言是否打开。

我使用我自己的分支库对其进行了测试,它正在工作。


推荐阅读