我遇到了问题。当我尝试使用以下命令创建一个新的rails项目/应用程序时: rails new app -d mysql 或 rails new app 我收到以下错误消息。 我的电脑运行Windows 10,64位,我正在使用rails 4.2.4。如果您需要更多信息,请随时提出。 (我删除了我的名字,这就是为什么你只看到Documents \ Sider)
Documents\Sider>rails new cmsw -d mysql
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
create app/assets/images/.keep
create app/mailers/.keep
create app/models/.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 config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/secrets.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/backtrace_silencers.rb
create config/initializers/cookies_serializer.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.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/favicon.ico
create public/robots.txt
create test/fixtures
create test/fixtures/.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/cache
create tmp/cache/assets
create vendor/assets/javascripts
create vendor/assets/javascripts/.keep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.keep
run bundle install
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rbreadline.rb:1097:in `<module:RbReadline>': HOME environment variable (or HOMEDRIVE and HOMEPATH) must be set and point to a directory (RuntimeError)
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rbreadline.rb:17:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/readline.rb:10:in `<module:Readline>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/readline.rb:8:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/vendor/thor/lib/thor/line_editor.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/vendor/thor/lib/thor/base.rb:8:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/vendor/thor/lib/thor.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/vendored_thor.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/friendly_errors.rb:3:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/bin/bundle:17:in `<main>'
答案 0 :(得分:1)
如果你的理由像我一样,这真是一个烦人的解决办法: 我的名字包括一个扩展的ASCII字符“ø”。当计算机在我的PC上设置我的帐户时,使用了那个。例如。 C:\用户\比约恩
。修复:将文件夹和您的家庭帐户重命名为Bjorn。
在您的系统上创建另一个管理员帐户,您可以将该帐户重命名为c:\ users \ Bjorn \
以下是重命名帐户的方法:https://superuser.com/questions/495290/how-to-rename-user-folder-in-windows-8
我从来没有在用户名中使用扩展字符,但是当我几年前设置Win8并且有可能使用微软帐户时,向导选择了用户名。
答案 1 :(得分:0)
似乎未设置您的环境变量。请按照link设置变量:
注意:建议不要在ruby on rails开发中使用 Window 。所以我建议使用Mac / Ubuntu作为ROR。这将真正让你的生活更轻松
答案 2 :(得分:0)
我遇到了同样的问题。我没有找到确切的解决方案,但找到了一些解决方法。实际上,Windows上的Rails不是直接从Windows的环境变量而是从文件中获取环境变量:
C:\ RailsInstaller \ GIT中\等\简档
我创建了一个文件夹PHFetchResultChangeDetails *collectionChanges = [changeInstance changeDetailsForFetchResult:self.assetsFetchResults];
[collectionView performBatchUpdates:^{
NSIndexSet *removedIndexes = [collectionChanges removedIndexes];
if ([removedIndexes count]) {
[collectionView deleteItemsAtIndexPaths:[self indexPathsFromIndexes:removedIndexes withSection:0]];
}
NSIndexSet *insertedIndexes = [collectionChanges insertedIndexes];
if ([insertedIndexes count]) {
[collectionView insertItemsAtIndexPaths:[self indexPathsFromIndexes:insertedIndexes withSection:0]];
}
} completion:^(BOOL finished) {
if (finished) {
// Puting this after removes and inserts indexes fixes a crash of deleting and reloading at the same time.
// From docs: When updating your app’s interface, apply changes after removals and insertions and before moves.
NSIndexSet *changedIndexes = [collectionChanges changedIndexes];
if ([changedIndexes count]) {
[collectionView reloadItemsAtIndexPaths:[self indexPathsFromIndexes:changedIndexes withSection:0]];
}
}
}
并在C:\Users\Test
中使用它的路径来替换发生故障的真实主路径:
C:\RailsInstaller\Git\etc\profile
之后必须设置错误“HOME环境变量(或HOMEDRIVE和HOMEPATH)并指向目录(RuntimeError)”已经消失。
这通常是一个错误的决定,但真正的解决方案有点相似。
在我的情况下问题是关于不同的编码,我的真正的主路径包含西里尔字符,因为它们不是ASCII rbreadline.rb不理解它们 - 因为最近的一些时间。但早些时候没有这样的问题,我不知道发生什么事情会使编码麻烦出现。