在 rails 中使用 Bootstrap Sass 时出错

Error on using Bootstrap Sass in rails

我正在 rails 应用程序上开发一个简单的 ruby,我收到以下错误:

TypeError: Cannot read property 'process' of undefined (in/home/saasbook/Documents/projects/Bookkeeper/app/assets/stylesheets/application.css.sass)

提取的源码如下:

<html>
<head>
<title>Bookkeeper</title>
<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %> //Highlighted error line in extract
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>

我使用 Bootstrap Sass 插件添加 Bootstrap Sass 并遵循此 tutorial

后发生此错误

摘录下方指出错误位于:

app/views/layouts/application.html.erb:5:in_app_views_layouts_application_html_erb__226809778_88444660'

我的代码

application.html.erb

<!DOCTYPE html>
<html>
 <head>
 <title>Bookkeeper</title>
    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>  //Highlighted error line in extract
    <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
    <%= csrf_meta_tags %>

 </head>
 <body>
    <%= yield %>
 </body>        
</html>

application.css.sass

/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree 
*= require_self
*/

@import "bootstrap-sprockets"
@import "bootstrap"

该页面在顶部的红色边框中显示此标题,是否有帮助?

ExecJS::ProgramError in Portal#index

autoprefixer-railsgem 5.0 版似乎有问题。尝试降级到 4.0.2.2。

https://github.com/ai/autoprefixer-rails/issues/47

如果您使用 Node 而不是 RubyRacer 作为您的 JS 运行时,这将弹出。

编辑 - 这已在最新版本的 autoprefixer 中修复。

bundle update autoprefixer-rails

这已在最新版本的 autoprefixer 中修复。使用以下命令升级 -

bundle update autoprefixer-rails