所以这是新事物。昨晚我花了5个小时阅读并尝试解决我遇到的问题。我尝试过多次在导轨上重新安装ruby,但是每次尝试启动服务器时都会出错,其他人也遇到类似的问题,但是地雷的修复方法无法与他们相同。当我运行命令时:
rails new myapp
create
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create Gemfile
run git init from "."
Initialized empty Git repository in /Users/ccc/Desktop/myapp/.git/
create package.json
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/javascript/channels/consumer.js
create app/javascript/channels/index.js
create app/javascript/packs/application.js
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/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/rails
create bin/rake
create bin/setup
create bin/yarn
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/cable.yml
create config/puma.rb
create config/spring.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/application_controller_renderer.rb
create config/initializers/assets.rb
create config/initializers/backtrace_silencers.rb
create config/initializers/content_security_policy.rb
create config/initializers/cookies_serializer.rb
create config/initializers/cors.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/new_framework_defaults_6_0.rb
create config/initializers/wrap_parameters.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
create test/fixtures/.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_6_0.rb
run bundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 13.0.1
Using concurrent-ruby 1.1.5
Using i18n 1.7.0
Using minitest 5.13.0
Using thread_safe 0.3.6
Using tzinfo 1.2.6
Using zeitwerk 2.2.2
Using activesupport 6.0.2.1
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.7
Using rails-dom-testing 2.0.3
Using crass 1.0.5
Using loofah 2.4.0
Using rails-html-sanitizer 1.3.0
Using actionview 6.0.2.1
Using rack 2.0.8
Using rack-test 1.1.0
Using actionpack 6.0.2.1
Using nio4r 2.5.2
Using websocket-extensions 0.1.4
Using websocket-driver 0.7.1
Using actioncable 6.0.2.1
Using globalid 0.4.2
Using activejob 6.0.2.1
Using activemodel 6.0.2.1
Using activerecord 6.0.2.1
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 6.0.2.1
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailbox 6.0.2.1
Using actionmailer 6.0.2.1
Using actiontext 6.0.2.1
Using public_suffix 4.0.3
Using addressable 2.7.0
Using bindex 0.8.1
Using msgpack 1.3.1
Using bootsnap 1.4.5
Using bundler 1.17.2
Using byebug 11.0.1
Using regexp_parser 1.6.0
Using xpath 3.2.0
Using capybara 3.30.0
Using childprocess 3.0.0
Using ffi 1.11.3
Using jbuilder 2.9.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.1
Using ruby_dep 1.5.0
Using listen 3.1.5
Using method_source 0.9.2
Using puma 4.3.1
Using rack-proxy 0.6.5
Using thor 1.0.1
Using railties 6.0.2.1
Using sprockets 4.0.0
Using sprockets-rails 3.2.1
Fetching rails 6.0.2.1
Installing rails 6.0.2.1
Using rubyzip 2.0.0
Using sassc 2.2.1
Using tilt 2.0.10
Using sassc-rails 2.1.2
Using sass-rails 6.0.0
Using selenium-webdriver 3.142.7
Using spring 2.1.0
Using spring-watcher-listen 2.0.1
Using sqlite3 1.4.2
Using turbolinks-source 5.2.0
Using turbolinks 5.2.1
Using web-console 4.0.1
Using webdrivers 4.2.0
Using webpacker 4.2.2
Bundle complete! 17 Gemfile dependencies, 75 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
run bundle binstubs bundler
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
run bundle exec spring binstub --all
* bin/rake: Spring inserted
* bin/rails: Spring inserted
rails webpacker:install
Traceback (most recent call last):
26: from bin/rails:3:in `<main>'
25: from bin/rails:3:in `load'
24: from /Users/ccc/Desktop/myapp/bin/spring:15:in `<top (required)>'
23: from /Users/ccc/Desktop/myapp/bin/spring:15:in `require'
22: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
21: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
20: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
19: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
18: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
17: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
16: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
15: from /Users/ccc/Desktop/myapp/bin/rails:8:in `<top (required)>'
14: from /Users/ccc/Desktop/myapp/bin/rails:8:in `require_relative'
13: from /Users/ccc/Desktop/myapp/config/boot.rb:4:in `<top (required)>'
12: from /Users/ccc/Desktop/myapp/config/boot.rb:4:in `require'
11: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `<top (required)>'
10: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `require_relative'
9: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `<top (required)>'
8: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `require_relative'
7: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
6: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
5: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
4: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:40:in `with_gems'
3: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
2: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `require'
1: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:9:in `<top (required)>'
/Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)
27: from bin/rails:3:in `<main>'
26: from bin/rails:3:in `load'
25: from /Users/ccc/Desktop/myapp/bin/spring:15:in `<top (required)>'
24: from /Users/ccc/Desktop/myapp/bin/spring:15:in `require'
23: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
22: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
21: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
20: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
19: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
18: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
17: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
16: from /Users/ccc/Desktop/myapp/bin/rails:8:in `<top (required)>'
15: from /Users/ccc/Desktop/myapp/bin/rails:8:in `require_relative'
14: from /Users/ccc/Desktop/myapp/config/boot.rb:4:in `<top (required)>'
13: from /Users/ccc/Desktop/myapp/config/boot.rb:4:in `require'
12: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `<top (required)>'
11: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `require_relative'
10: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `<top (required)>'
9: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `require_relative'
8: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
7: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
6: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
5: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:40:in `with_gems'
4: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
3: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `require'
2: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:8:in `<top (required)>'
1: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:11:in `rescue in <top (required)>'
/Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:11:in `require': incompatible library version - /Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack/msgpack.bundle (LoadError)
27: from bin/rails:3:in `<main>'
26: from bin/rails:3:in `load'
25: from /Users/ccc/Desktop/myapp/bin/spring:15:in `<top (required)>'
24: from /Users/ccc/Desktop/myapp/bin/spring:15:in `require'
23: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
22: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
21: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
20: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
19: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
18: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
17: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
16: from /Users/ccc/Desktop/myapp/bin/rails:8:in `<top (required)>'
15: from /Users/ccc/Desktop/myapp/bin/rails:8:in `require_relative'
14: from /Users/ccc/Desktop/myapp/config/boot.rb:4:in `<top (required)>'
13: from /Users/ccc/Desktop/myapp/config/boot.rb:4:in `require'
12: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `<top (required)>'
11: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `require_relative'
10: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `<top (required)>'
9: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `require_relative'
8: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
7: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
6: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
5: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:39:in `with_gems'
4: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:43:in `rescue in with_gems'
3: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
2: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `require'
1: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:9:in `<top (required)>'
/Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)
28: from bin/rails:3:in `<main>'
27: from bin/rails:3:in `load'
26: from /Users/ccc/Desktop/myapp/bin/spring:15:in `<top (required)>'
25: from /Users/ccc/Desktop/myapp/bin/spring:15:in `require'
24: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
23: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
22: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
21: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
20: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
19: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
18: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
17: from /Users/ccc/Desktop/myapp/bin/rails:8:in `<top (required)>'
16: from /Users/ccc/Desktop/myapp/bin/rails:8:in `require_relative'
15: from /Users/ccc/Desktop/myapp/config/boot.rb:4:in `<top (required)>'
14: from /Users/ccc/Desktop/myapp/config/boot.rb:4:in `require'
13: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `<top (required)>'
12: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `require_relative'
11: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `<top (required)>'
10: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `require_relative'
9: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
8: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
7: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
6: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:39:in `with_gems'
5: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:43:in `rescue in with_gems'
4: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
3: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `require'
2: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:8:in `<top (required)>'
1: from /Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:11:in `rescue in <top (required)>'
/Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:11:in `require': incompatible library version - /Users/ccc/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack/msgpack.bundle (LoadError)
这甚至是一个新问题,昨天我唯一遇到的问题是试图运行服务器以查看“ Yayyou处于正常状态”,但它不起作用。
好吧,可能是很多事情,因为您是新手,还有一些问题。让我们通过以下几个命令来开始诊断问题,然后看看您得到了什么。运行以下命令
node -v
我的回复是12.10.0
,您可能已经接近了,现在检查npm和纱线版本
npm -v
我的npm是6.11.3
,您应该有一些接近它的地方。现在查看毛线版本
yarn --version
我的系统具有1.17.3
版本。现在,如果一切都已安装,并且没有错误,但是版本较旧,请尝试更新为接近这些版本。
首先检查安装了哪个版本的msgpack
gem info msgpack
根据您的错误应该为msgpack (1.3.1)
,它也相同,也为了安全起见,请检查ruby版本ruby -v
应该为ruby 2.6.3版本。如果您可以获取有关msgpack的正确信息和版本,则可以,但请尝试以下操作
gem uninstall msgpack
现在进入rails文件夹并运行以下命令
bundle install
现在看看是否有任何错误。