如何解决部署到 Heroku 时出现 Rails rake 问题
解决方案:我使用 Bundler 版本 2.2.4 运行 ruby 2.6.6p146。根据@thiebo 的建议,我降级到 Bundler 2.1.2 并且成功了!步骤:
- $ gem 卸载捆绑器
- [然后删除 Gemfile.lock]
- $ gem install bundler --version '2.1.2'
我尝试了这些选项,但没有任何效果:heroku push error: "Could not detect rake tasks"
我确实可以对我的应用程序运行 bundle exec rake -P
我尝试拯救 Rakefile,并在我的 Gemfile 中将 rspec 投入生产:Heroku could not detect rake tasks (LoadError: cannot load such file -- rspec/core/rake_task)
我在 gemfile 中添加了 'rake'。
尝试添加 gem 'rack-timeout':Heroku 'Could not detect rake tasks'
我也跟着这个线程无济于事:https://github.com/rubygems/bundler/issues/3640
错误如下:
const recordAudio = () =>
new Promise(async resolve => {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
const mediaRecorder = new MediaRecorder(stream);
const audioChunks = [];
mediaRecorder.addEventListener("dataavailable",event => {
audioChunks.push(event.data);
});
const start = () => mediaRecorder.start();
const stop = () =>
new Promise(resolve => {
mediaRecorder.addEventListener("stop",() => {
const audioBlob = new Blob(audioChunks);
const audioUrl = URL.createObjectURL(audioBlob);
const audio = new Audio(audioUrl);
const play = () => audio.play();
resolve({ audioBlob,audioUrl,play });
});
mediaRecorder.stop();
});
resolve({ start,stop });
});
const sleep = time => new Promise(resolve => setTimeout(resolve,time));
const handleAction = async () => {
const recorder = await recordAudio();
const actionButton = document.getElementById('action');
actionButton.disabled = true;
recorder.start();
await sleep(3000);
const audio = await recorder.stop();
//audio.play();
console.log(audio);
await sleep(3000);
console.log("Finished");
actionButton.disabled = false;
}
非常感谢,如果有人知道。
解决方法
简答
使用 Heroku 支持的 bundler 版本
gem uninstall bundler
gem install bundler --version '2.1.2'
rm Gemfile.lock
bundle install
git add Gemfile.lock
git commit -m "downgrade bundler to appease the Heroku gods"
git push heroku
这个问题好像以前也发生过:https://github.com/rubygems/bundler/issues/7486
,我刚刚遇到了这个问题和 official documentation worked:
捆绑器 2.2.3+
在本地使用 Bundler 2.2.3 生成的应用程序的 Gemfile.lock 可能无法在 Heroku 上运行,除非 Linux 平台被明确“锁定”:
$ bundle lock --add-platform ruby
$ bundle lock --add-platform x86_64-linux
$ bundle install
$ git add . ; git commit -m "Bundler fix"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。