Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Erro no rails new

Boa noite! Estou com problemas ao executar o comando rails new lojadecamisetas

A mensagem de erro que aparece no terminal:

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:253:in `mkdir': Operation not permitted @ dir_s_mkdir - /bin/lojadecamisetas (Errno::EPERM)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:253:in `fu_mkdir'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:227:in `block (2 levels) in mkdir_p'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:225:in `reverse_each'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:225:in `block in mkdir_p'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:211:in `each'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:211:in `mkdir_p'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/actions/empty_directory.rb:52:in `block in invoke!'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/actions/empty_directory.rb:117:in `invoke_with_conflict_check'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/actions/empty_directory.rb:50:in `invoke!'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/actions.rb:94:in `action'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/actions/empty_directory.rb:14:in `empty_directory'
    from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.5/lib/rails/generators/app_base.rb:157:in `create_root'
    from (eval):1:in `create_root'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
    from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.5/lib/rails/commands/application/application_command.rb:24:in `perform'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
    from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
    from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.5/lib/rails/command/base.rb:63:in `perform'
    from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.5/lib/rails/command.rb:44:in `invoke'
    from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.5/lib/rails/cli.rb:16:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.5/exe/rails:9:in `<top (required)>'
    from /usr/bin/rails:22:in `load'
    from /usr/bin/rails:22:in `<main>'

Fui até o arquivo fileutils.rb:253, e o código lá é o seguinte:

  def fu_mkdir(path, mode)   #:nodoc:
    path = remove_trailing_slash(path)
    if mode
      Dir.mkdir path, mode
      File.chmod mode
    else
      Dir.mkdir path  #essa é a linha 253
    end
  end

Configurações do Sistema:

MacOS High Sierra, versão 10.13.3 Ruby: 2.3.3p222 Rails: 5.1.

Caso precisem de mais informações avisem que mando Obrigado desde já!

2 respostas
solução!

Oi José Fernandes, tudo bem ?

Você tentou executar o comando como sudo ? Parece que é problema de permissão.

Exatamente isso Caio!

Obrigado pela resposta. Logo depois aconteceu com o comando rails server, e executando como sudo funcionou.