我是 Rails 新手,这是我的问题。
我通过此命令创建了一个新的 Rails 文件夹
rails new freelancer --database=postgresql --javascript=webpack
这是我在创建文件夹时遇到的错误
An error occurred while installing bootsnap (1.16.0), and Bundler cannot continue.
所以当我签入这个文件夹时
config -> locales
我没有看到文件database.yml?
那么我该如何解决所有这些问题呢?您能给我一些建议吗?非常感谢您的宝贵时间。
这是完整的堆栈跟踪
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create .gitattributes
create Gemfile
run git init from "."
gợi ý: Sử dụng “master” làm tên cho nhánh ban đầu. Tên nhánh mặc định này
gợi ý: có thể thay đổi. Để cấu hình tên nhánh khởi đầu sử dụng trong tất cả
gợi ý: kho lưu trữ mới của bạn, cái mà sẽ ngăn chặn cảnh báo này, gọi lệnh:
gợi ý:
gợi ý: git config --global init.defaultBranch <tên>
gợi ý:
gợi ý: Tên thường được chọn thay cho “master” là “main”, “trunk” và
gợi ý: “development”. Nhánh vừa tạo có thể được đổi tên thông qua lệnh:
gợi ý:
gợi ý: git branch -m <tên>
Đã khởi tạo lại kho Git trống rỗng sẵn có trong
/Users/anhbui/Desktop/Rails/freelancer/.git/
create app
create app/assets/config/manifest.js
create app/assets/stylesheets/application.css
create app/channels/application_cable/channel.rb
create app/channels/application_cable/connection.rb
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/jobs/application_job.rb
create app/mailers/application_mailer.rb
create app/models/application_record.rb
create app/views/layouts/application.html.erb
create app/views/layouts/mailer.html.erb
create app/views/layouts/mailer.text.erb
create app/assets/images
create app/assets/images/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/rails
create bin/rake
create bin/setup
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/cable.yml
create config/puma.rb
create config/storage.yml
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/assets.rb
create config/initializers/content_security_policy.rb
create config/initializers/cors.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/new_framework_defaults_7_0.rb
create config/initializers/permissions_policy.rb
create config/locales
create config/locales/en.yml
create config/master.key
append .gitignore
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create lib
create lib/tasks
create lib/tasks/.keep
create lib/assets
create lib/assets/.keep
create log
create log/.keep
create public
create public/404.html
create public/422.html
create public/500.html
create public/apple-touch-icon-precomposed.png
create public/apple-touch-icon.png
create public/favicon.ico
create public/robots.txt
create tmp
create tmp/.keep
create tmp/pids
create tmp/pids/.keep
create tmp/cache
create tmp/cache/assets
create vendor
create vendor/.keep
create test/fixtures/files
create test/fixtures/files/.keep
create test/controllers
create test/controllers/.keep
create test/mailers
create test/mailers/.keep
create test/models
create test/models/.keep
create test/helpers
create test/helpers/.keep
create test/integration
create test/integration/.keep
create test/channels/application_cable/connection_test.rb
create test/test_helper.rb
create test/system
create test/system/.keep
create test/application_system_test_case.rb
create storage
create storage/.keep
create tmp/storage
create tmp/storage/.keep
remove config/initializers/cors.rb
remove config/initializers/new_framework_defaults_7_0.rb
run bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using. rake 13.0.6
Using. concurrent-ruby 1.2.0
Using. minitest 5.17.0
Using. builder 3.2.4
Using. marcel 1.0.2
Using. racc 1.6.2
Using crass 1.0.6
Using. rack 2.2.6.2
Using. public_suffix 5.0.1
Using. nio4r 2.5.8
Using. bundler 2.3.26
Using. mini_mime 1.1.2
Using. websocket-extensions 0.1.5
Using. timeout 0.3.1
Using. matrix 0.4.2
Using. regexp_parser 2.6.2
Using. bindex 0.8.1
Using. erubi 1.12.0
Using. io-console 0.6.0
Using. rexml 3.2.5
Using. method_source 1.0.0
Using. zeitwerk 2.6.6
Using. thor 1.2.1
Using. date 3.3.3
Using. nokogiri 1.14.1 (arm64-darwin)
Using. pg 1.4.5
Using msgpack 1.6.0
Using. websocket 1.2.9
Using. websocket-driver 0.7.5
Using. tzinfo 2.0.6
Using. addressable 2.8.1
Using. rack-test 2.0.2
Using. sprockets 4.2.0
Using. rubyzip 2.3.2
Using. i18n 1.12.0
Using. puma 5.6.5
Using. selenium-webdriver 4.8.0
Using. reline 0.3.2
Using. loofah 2.19.1
Using. webdrivers 5.2.0
Using. net-protocol 0.2.1
Using. activesupport 7.0.4.2
Using. xpath 3.2.0
Using. irb 1.6.2
Using. net-imap 0.3.4
Using. rails-dom-testing 2.0.3
Using. net-smtp 0.3.3
Using. capybara 3.38.0
Using. rails-html-sanitizer 1.5.0
Using. globalid 1.1.0
Using. net-pop 0.1.2
Using. actionview 7.0.4.2
Using. activejob 7.0.4.2
Using. jbuilder 2.11.5
Using. activemodel 7.0.4.2
Using. mail 2.8.0.1
Using actionpack 7.0.4.2
Using. debug 1.7.1
Using. actioncable 7.0.4.2
Using. actionmailer 7.0.4.2
Using. railties 7.0.4.2
Using. activerecord 7.0.4.2
Using. sprockets-rails 3.4.2
Using. activestorage 7.0.4.2
Using. jsbundling-rails 1.1.1
Using. stimulus-rails 1.2.1
Using. turbo-rails 1.3.3
Using. web-console 4.2.0
Using. actionmailbox 7.0.4.2
Using. actiontext 7.0.4.2
Using. rails 7.0.4.2
Installing bootsnap 1.16.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.16.0/ext/bootsnap
/Users/anhbui/.rvm/rubies/ruby-3.1.2/bin/ruby -I
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0 -r
./siteconf20230202-5546-vke9r8.rb extconf.rb
creating Makefile
current directory:
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.16.0/ext/bootsnap
make DESTDIR\= clean
xcrun: error: invalid active developer path
(/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun
current directory:
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.16.0/ext/bootsnap
make DESTDIR\=
xcrun: error: invalid active developer path
(/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun
make failed, exit code 1
Gem. files will remain installed in
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.16.0 for inspection.
Results logged to
/Users/anhbui/.rvm/gems/ruby-3.1.2/extensions/arm64-darwin-21/3.1.0/bootsnap-1.16.0/gem_make.out
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/ext/builder.rb:95:in
`run'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/ext/builder.rb:44:in
`block in make'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/ext/builder.rb:36:in
`each'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/ext/builder.rb:36:in
`make'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:63:in
`block in build'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tempfile.rb:317:in `open'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in
`build'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/ext/builder.rb:161:in
`build_extension'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/ext/builder.rb:195:in
`block in build_extensions'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in
`each'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in
`build_extensions'
/Users/anhbui/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/installer.rb:853:in
`build_extensions'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/rubygems_gem_installer.rb:72:in
`build_extensions'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/source/rubygems.rb:207:in
`install'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/installer/gem_installer.rb:54:in
`install'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/worker.rb:62:in
`apply_func'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/worker.rb:57:in
`block in process_queue'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/worker.rb:54:in
`loop'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/worker.rb:54:in
`process_queue'
/Users/anhbui/.rvm/gems/ruby-3.1.2/gems/bundler-2.3.26/lib/bundler/worker.rb:91:in
`block (2 levels) in create_threads'
An error occurred while installing bootsnap (1.16.0), and Bundler cannot continue.
您缺少 Xcode 命令行工具。您可以通过错误消息的这一部分来判断:
xcrun: error: invalid active developer path
(/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun
您可以通过使用 Google 搜索确切的错误消息来找到解决方案,该消息将引导您这个问不同的答案 https://apple.stackexchange.com/questions/254380/why-am-i-getting-an-invalid-active-developer-path-when-attempting-to-use-git-a作为最高结果。
要解决此问题:
- 打开终端窗口
- 运行命令
xcode-select --install
- 按照屏幕上的所有提示进行操作
- 删除
freelancer
目录
- 重试命令
rails new freelancer --database=postgresql --javascript=webpack
You can 阅读有关命令行工具的更多信息 https://www.freecodecamp.org/news/install-xcode-command-line-tools/在各种地方。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)