Rake assets:预编译在 Windows 计算机上失败



我有一个类似的问题,多次报告,例如这里: 耙子资产:预编译 RAILS_ENV=生产无法按要求工作

我的设置如下:

-- rails 5.1
-- any application (e.g. an empty one, just generated the app, bundle, rake assets:precompile)
-- error: 

c:\RailsApps\asset_pipeline_test>bundle exec rake assets:precompile I, [2018-05-08T01:26:06.195454 #7876] 信息 -- : 正在编写 c:/RailsApps/asset_pipeline_test/public/assets/application-a51a53658dfaa975cb4363f51d14bccf24d66c3d90c2186bf834c157151c4bd1.js 耙子中止了! NoMethodError: undefined method 'post' for nil:NilClass 任务:顶部 => 资源:预编译

不同的应用程序会出现相同的错误。

与其他报告问题的区别:

-- I am using two similar w7pro machines
-- on one machine rake assets:precompile is working
-- on the other machine it's failing

我将应用程序的 1:1 副本和 Ruby/Rails 安装文件夹从工作机器放到失败的机器上。

我检查了任何类型的环境变量,发现没有区别。

我想应用程序之外的机器和 Ruby 设置之间存在差异。

问题:那会有什么区别?两台机器最初都是由相同的操作系统映像(由我公司的 IT 设置的(,但它们当然不是新鲜的

乌利

检查系统当前用户的ruby 版本

rvm list

确保在捆绑过程中采取相同的措施。如果需要其他版本,请为用户正确安装 ruby。

更好的方式捆绑

bundle exec rake assets:precompile RAILS_ENV=production

捆绑包的 Ruby 版本应与当前系统用户的 Ruby 版本匹配。捆绑包可以在以下位置找到

/usr/bin/

/usr/local/

相关内容

最新更新