大家好,感谢您成为这样一个伟大的社区。
我正在使用rails启动一个新项目,而我已经开始遇到问题了。创建一个新的应用程序后,我试图生成一个新的控制器,以便我可以开始工作,rails正在抛出这个错误。我做了所有固定轨道建议,我也遇到了同样的问题
错误:
gdiop@localhost:~/Desktop//app> rails new wp
create
create README.md
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/config/manifest.js
create app/assets/javascripts/application.js
create app/assets/javascripts/cable.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/.keep
create app/assets/javascripts/channels
create app/assets/javascripts/channels/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/bundle
create bin/rails
create bin/rake
create bin/setup
create bin/update
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/secrets.yml
create config/cable.yml
create config/puma.rb
create config/spring.rb
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/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.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
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 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/test_helper.rb
create tmp
create tmp/.keep
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
create vendor/assets/javascripts/.keep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.keep
remove config/initializers/cors.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 version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.0.0
Using concurrent-ruby 1.0.5
Using i18n 0.8.4
Using minitest 5.10.2
Using thread_safe 0.3.6
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.2.0
Using rack 2.0.3
Using nio4r 2.1.0
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 7.1.4
Using bundler 1.15.0
Using method_source 0.8.2
Using thor 0.19.4
Using sqlite3 1.3.13
Using puma 3.9.1
Using sass 3.4.24
Using tilt 2.0.7
Using execjs 2.7.0
Using coffee-script-source 1.12.2
Using turbolinks-source 5.0.3
Using multi_json 1.12.1
Using byebug 9.0.6
Using bindex 0.5.0
Using rb-fsevent 0.9.8
Using ffi 1.9.18
Using tzinfo 1.2.3
Using nokogiri 1.8.0
Using rack-test 0.6.3
Using sprockets 3.7.1
Using websocket-driver 0.6.5
Using mime-types 3.1
Using uglifier 3.2.0
Using coffee-script 2.4.1
Using turbolinks 5.0.1
Using rb-inotify 0.9.8
Using activesupport 5.0.3
Using loofah 2.0.3
Using mail 2.6.6
Using listen 3.0.8
Using rails-dom-testing 2.0.3
Using globalid 0.4.0
Using activemodel 5.0.3
Using jbuilder 2.7.0
Using spring 2.0.2
Using rails-html-sanitizer 1.0.3
Using activejob 5.0.3
Using activerecord 5.0.3
Using spring-watcher-listen 2.0.1
Using actionview 5.0.3
Using actionpack 5.0.3
Using actioncable 5.0.3
Using actionmailer 5.0.3
Using railties 5.0.3
Using sprockets-rails 3.2.0
Using coffee-rails 4.2.2
Using jquery-rails 4.3.1
Using web-console 3.5.1
Using rails 5.0.3
Using sass-rails 5.0.6
Bundle complete! 15 Gemfile dependencies, 62 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
The latest bundler is 1.15.1, but you are currently running 1.15.0.
To update, run `gem install bundler`
run bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
gdiop@localhost:~/Desktop//app> cd wp
gdiop@localhost:~/Desktop/app/wp> bin/rails generate controller Welcome index
Ignoring bindex-0.5.0 because its extensions are not built. Try: gem pristine bindex --version 0.5.0
/usr/lib64/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/spec_set.rb:87:in `block in materialize': Could not find nokogiri-1.8.0 in any of the sources (Bundler::GemNotFound)
from /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/spec_set.rb:81:in `map!'
from /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/spec_set.rb:81:in `materialize'
from /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/definition.rb:159:in `specs'
from /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/definition.rb:218:in `specs_for'
from /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/definition.rb:207:in `requested_specs'
from /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/runtime.rb:109:in `block in definition_method'
from /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/runtime.rb:21:in `setup'
from /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler.rb:101:in `setup'
from /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/setup.rb:20:in `<top (required)>'
from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/lib64/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/commands.rb:33:in `<module:Spring>'
from /usr/lib64/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/commands.rb:4:in `<top (required)>'
from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/lib64/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/server.rb:9:in `<top (required)>'
from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/lib64/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/server.rb:9:in `call'
from /usr/lib64/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
from /usr/lib64/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
from /usr/lib64/ruby/gems/2.3.0/gems/spring-2.0.2/bin/spring:49:in `<main>'
gdiop@localhost:~/Desktop/app/wp>
我运行了bundle install和gem pristine bindex,没有!我仍然有同样的错误!
请帮忙!
谢谢
编辑:我可以启动美洲狮没问题,但我不能创建一个新的控制器,这是我的宝石文件:source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.3'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
编辑:
干净的重新安装修复了我的问题。我不想去那个极端,但这是我唯一的选择......
答案 0 :(得分:1)
尝试使用 <p>One<br>Two<br>Three<br><span style="color:red">Four</span></p>
使用bundle exec rails g controller Welcome index
将锁定对您在Gemfile中指定的特定gem的所有调用,而不是全局安装。
尝试评论以下宝石:
bundle exec
然后在此完成后运行gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
再次运行命令:bundle update
答案 1 :(得分:0)
尝试将此行添加到您的gemfile
gem pristine bindex --version 0.5.0
也试试
rails generate controller welcome
没有索引方法,稍后手动添加。
答案 2 :(得分:0)
在命令中停止使用bin/rails
。使用:
rails g controller Welcome index