简体   繁体   English

无法使用捆绑锁将平台添加到 Gemfile.lock

[英]Cannot add platform to Gemfile.lock using bundle lock

I am trying to push a project to Heroku for the first time using git push heroku master .我第一次尝试使用git push heroku master项目推送到 Heroku。 However, I end up getting the following error:但是,我最终收到以下错误:

Your bundle only supports platforms ["arm64-darwin-21"] but your local platform is x86_64-linux.您的包仅支持平台 ["arm64-darwin-21"] 但您的本地平台是 x86_64-linux。 Add the current platform to the lockfile with bundle lock --add-platform x86_64-linux and try again.使用bundle lock --add-platform x86_64-linux将当前平台添加到锁定文件中,然后重试。

Running bundle lock --add-platform x86_64-linux in turn results in the following output:依次运行bundle lock --add-platform x86_64-linux结果如下 output:

[17052, #<Thread:0x000000015307bc60 run>, #<NameError: uninitialized constant Gem::Source [17052, #<Thread:0x000000015307bc60 run>, #<NameError: 未初始化常量 Gem::Source

... followed by a hundred lines of different paths on my computer. ...接着是我电脑上的一百行不同的路径。

Does anyone know how to interpret and solve this kind of output?有谁知道如何解释和解决这种output?

Thank you very much for your help!非常感谢您的帮助!

Are you using M1 Mac?你用的是 M1 Mac 吗? if yes then which means the platform is arm64-darwin-20, but the production environment is not.如果是,则表示平台是 arm64-darwin-20,但生产环境不是。

Try to run below two commands and that will add the two platforms in Gemfile.lock尝试运行以下两个命令,这将在 Gemfile.lock 中添加两个平台

bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux

rm -rf Gemfile.lock and run bundle install rm -rf Gemfile.lock并运行bundle install

It's solved here too. 这里也解决了。 FYI供参考

  • bundle lock --add-platform ruby捆绑锁——添加平台 ruby
  • bundle lock --add-platform x86_64-linux捆绑锁 --add-platform x86_64-linux

The first answer in the following stack overflow thread did the job for me:以下堆栈溢出线程中的第一个答案为我做了这项工作:

Rails uninitialized constant Bundler (NameError) Rails 未初始化常量 Bundler (NameError)

#remove project-specific settings
rm -rf .bundle/

# remove project-specific cached gems and repos
rm -rf vendor/cache/

# remove the saved resolve of the Gemfile
rm -rf Gemfile.lock

# rebundle 
bundle install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM