在rails中使用Bootstrap Sass时出错

ano*_*432 6 css ruby ruby-on-rails sass twitter-bootstrap

我正在使用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 %>
Run Code Online (Sandbox Code Playgroud)

在我使用Bootstrap Sass插件添加Bootstrap Sass并遵循本教程后发生此错误

在摘录下面,它表明错误在:

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>
Run Code Online (Sandbox Code Playgroud)

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"
Run Code Online (Sandbox Code Playgroud)

该页面在红色边框顶部显示此标题,这有什么帮助吗?

ExecJS::ProgramError in Portal#index

小智 8

autoprefixer-rails gem的5.0版本似乎存在问题.尝试降级到4.0.2.2.

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

如果您使用Node而不是RubyRacer作为JS运行时,则会弹出.

编辑 - 已在最新版本的autoprefixer中修复此问题.

bundle update autoprefixer-rails
Run Code Online (Sandbox Code Playgroud)

  • 而不是降级`autoprefixer-rails` gem版本添加`gem'therubyracer',平台:: ruby​​`帮助我摆脱了报告的错误.谢谢. (4认同)