質問編集履歴

7

$ rails sの後、コマンドが打てなくなる

2018/11/08 12:17

投稿

neemo
neemo

スコア12

test CHANGED
File without changes
test CHANGED
@@ -74,8 +74,378 @@
74
74
 
75
75
  いや、むしろローカルでの環境構築をやめて、クラウド(AWS)を使った方がいいのですかね・・・かなりの素人なもので。。
76
76
 
77
+ <追記4>
78
+
79
+ 新しいファイルを作って、やり直してみました。しかし、下記の通り、rails sでサーバー立ち上げ、完了した?後、コマンドが打てなくなりました・・・。トップ画面を作成したいと思っていたのですが。
80
+
81
+ この時点で、http://localhost:3000/は表示されています。
82
+
83
+
84
+
77
85
  ```
78
86
 
87
+ ```eri-no-MacBook-Air:~ eri$ cd desktop
88
+
89
+ eri-no-MacBook-Air:desktop eri$ cd Newprojects
90
+
91
+ eri-no-MacBook-Air:Newprojects eri$ rails new rails_practice
92
+
93
+ create
94
+
95
+ create README.rdoc
96
+
97
+ create Rakefile
98
+
99
+ create config.ru
100
+
101
+ create .gitignore
102
+
103
+ create Gemfile
104
+
105
+ create app
106
+
107
+ create app/assets/javascripts/application.js
108
+
109
+ create app/assets/stylesheets/application.css
110
+
111
+ create app/controllers/application_controller.rb
112
+
113
+ create app/helpers/application_helper.rb
114
+
115
+ create app/views/layouts/application.html.erb
116
+
117
+ create app/assets/images/.keep
118
+
119
+ create app/mailers/.keep
120
+
121
+ create app/models/.keep
122
+
123
+ create app/controllers/concerns/.keep
124
+
125
+ create app/models/concerns/.keep
126
+
127
+ create bin
128
+
129
+ create bin/bundle
130
+
131
+ create bin/rails
132
+
133
+ create bin/rake
134
+
135
+ create bin/setup
136
+
137
+ create config
138
+
139
+ create config/routes.rb
140
+
141
+ create config/application.rb
142
+
143
+ create config/environment.rb
144
+
145
+ create config/secrets.yml
146
+
147
+ create config/environments
148
+
149
+ create config/environments/development.rb
150
+
151
+ create config/environments/production.rb
152
+
153
+ create config/environments/test.rb
154
+
155
+ create config/initializers
156
+
157
+ create config/initializers/assets.rb
158
+
159
+ create config/initializers/backtrace_silencers.rb
160
+
161
+ create config/initializers/cookies_serializer.rb
162
+
163
+ create config/initializers/filter_parameter_logging.rb
164
+
165
+ create config/initializers/inflections.rb
166
+
167
+ create config/initializers/mime_types.rb
168
+
169
+ create config/initializers/session_store.rb
170
+
171
+ create config/initializers/wrap_parameters.rb
172
+
173
+ create config/locales
174
+
175
+ create config/locales/en.yml
176
+
177
+ create config/boot.rb
178
+
179
+ create config/database.yml
180
+
181
+ create db
182
+
183
+ create db/seeds.rb
184
+
185
+ create lib
186
+
187
+ create lib/tasks
188
+
189
+ create lib/tasks/.keep
190
+
191
+ create lib/assets
192
+
193
+ create lib/assets/.keep
194
+
195
+ create log
196
+
197
+ create log/.keep
198
+
199
+ create public
200
+
201
+ create public/404.html
202
+
203
+ create public/422.html
204
+
205
+ create public/500.html
206
+
207
+ create public/favicon.ico
208
+
209
+ create public/robots.txt
210
+
211
+ create test/fixtures
212
+
213
+ create test/fixtures/.keep
214
+
215
+ create test/controllers
216
+
217
+ create test/controllers/.keep
218
+
219
+ create test/mailers
220
+
221
+ create test/mailers/.keep
222
+
223
+ create test/models
224
+
225
+ create test/models/.keep
226
+
227
+ create test/helpers
228
+
229
+ create test/helpers/.keep
230
+
231
+ create test/integration
232
+
233
+ create test/integration/.keep
234
+
235
+ create test/test_helper.rb
236
+
237
+ create tmp/cache
238
+
239
+ create tmp/cache/assets
240
+
241
+ create vendor/assets/javascripts
242
+
243
+ create vendor/assets/javascripts/.keep
244
+
245
+ create vendor/assets/stylesheets
246
+
247
+ create vendor/assets/stylesheets/.keep
248
+
249
+ run bundle install
250
+
251
+ Fetching gem metadata from https://rubygems.org/..........
252
+
253
+ Fetching gem metadata from https://rubygems.org/.
254
+
255
+ Resolving dependencies......
256
+
257
+ Using rake 12.3.1
258
+
259
+ Using concurrent-ruby 1.1.3
260
+
261
+ Using i18n 0.9.5
262
+
263
+ Using json 1.8.6
264
+
265
+ Using minitest 5.11.3
266
+
267
+ Using thread_safe 0.3.6
268
+
269
+ Using tzinfo 1.2.5
270
+
271
+ Using activesupport 4.2.6
272
+
273
+ Using builder 3.2.3
274
+
275
+ Using erubis 2.7.0
276
+
277
+ Using mini_portile2 2.3.0
278
+
279
+ Using nokogiri 1.8.5
280
+
281
+ Using rails-deprecated_sanitizer 1.0.3
282
+
283
+ Using rails-dom-testing 1.0.9
284
+
285
+ Using crass 1.0.4
286
+
287
+ Using loofah 2.2.3
288
+
289
+ Using rails-html-sanitizer 1.0.4
290
+
291
+ Using actionview 4.2.6
292
+
293
+ Using rack 1.6.11
294
+
295
+ Using rack-test 0.6.3
296
+
297
+ Using actionpack 4.2.6
298
+
299
+ Using globalid 0.4.1
300
+
301
+ Using activejob 4.2.6
302
+
303
+ Using mini_mime 1.0.1
304
+
305
+ Using mail 2.7.1
306
+
307
+ Using actionmailer 4.2.6
308
+
309
+ Using activemodel 4.2.6
310
+
311
+ Using arel 6.0.4
312
+
313
+ Using activerecord 4.2.6
314
+
315
+ Using debug_inspector 0.0.3
316
+
317
+ Using binding_of_caller 0.8.0
318
+
319
+ Using bundler 1.17.1
320
+
321
+ Using byebug 10.0.2
322
+
323
+ Using coffee-script-source 1.12.2
324
+
325
+ Using execjs 2.7.0
326
+
327
+ Using coffee-script 2.4.1
328
+
329
+ Using thor 0.20.0
330
+
331
+ Using railties 4.2.6
332
+
333
+ Using coffee-rails 4.1.1
334
+
335
+ Using ffi 1.9.25
336
+
337
+ Using multi_json 1.13.1
338
+
339
+ Using jbuilder 2.8.0
340
+
341
+ Using jquery-rails 4.3.3
342
+
343
+ Using sprockets 3.7.2
344
+
345
+ Using sprockets-rails 3.2.1
346
+
347
+ Using rails 4.2.6
348
+
349
+ Using rb-fsevent 0.10.3
350
+
351
+ Using rb-inotify 0.9.10
352
+
353
+ Using rdoc 4.3.0
354
+
355
+ Using sass-listen 4.0.0
356
+
357
+ Fetching sass 3.7.1
358
+
359
+ Installing sass 3.7.1
360
+
361
+ Using tilt 2.0.8
362
+
363
+ Using sass-rails 5.0.7
364
+
365
+ Using sdoc 0.4.2
366
+
367
+ Using spring 2.0.2
368
+
369
+ Using sqlite3 1.3.13
370
+
371
+ Using turbolinks-source 5.2.0
372
+
373
+ Using turbolinks 5.2.0
374
+
375
+ Using uglifier 4.1.19
376
+
377
+ Using web-console 2.3.0
378
+
379
+ Bundle complete! 12 Gemfile dependencies, 60 gems now installed.
380
+
381
+ Use `bundle info [gemname]` to see where a bundled gem is installed.
382
+
383
+ Post-install message from sass:
384
+
385
+
386
+
387
+ Ruby Sass is deprecated and will be unmaintained as of 26 March 2019.
388
+
389
+
390
+
391
+ * If you use Sass as a command-line tool, we recommend using Dart Sass, the new
392
+
393
+ primary implementation: https://sass-lang.com/install
394
+
395
+
396
+
397
+ * If you use Sass as a plug-in for a Ruby web framework, we recommend using the
398
+
399
+ sassc gem: https://github.com/sass/sassc-ruby#readme
400
+
401
+
402
+
403
+ * For more details, please refer to the Sass blog:
404
+
405
+ http://sass.logdown.com/posts/7081811
406
+
407
+
408
+
409
+ run bundle exec spring binstub --all
410
+
411
+ * bin/rake: spring inserted
412
+
413
+ * bin/rails: spring inserted
414
+
415
+ eri-no-MacBook-Air:Newprojects eri$ cd rails_practice
416
+
417
+ eri-no-MacBook-Air:rails_practice eri$ rails s
418
+
419
+ => Booting WEBrick
420
+
421
+ => Rails 4.2.6 application starting in development on http://localhost:3000
422
+
423
+ => Run `rails server -h` for more startup options
424
+
425
+ => Ctrl-C to shutdown server
426
+
427
+ [2018-11-08 20:34:29] INFO WEBrick 1.3.1
428
+
429
+ [2018-11-08 20:34:29] INFO ruby 2.3.1 (2016-04-26) [x86_64-darwin17]
430
+
431
+ [2018-11-08 20:34:29] INFO WEBrick::HTTPServer#start: pid=95300 port=3000
432
+
433
+
434
+
435
+
436
+
437
+ Started GET "/" for ::1 at 2018-11-08 20:39:15 +0900
438
+
439
+ Processing by Rails::WelcomeController#index as HTML
440
+
441
+ Rendered /Users/eri/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/templates/rails/welcome/index.html.erb (4.3ms)
442
+
443
+ Completed 200 OK in 44ms (Views: 26.5ms | ActiveRecord: 0.0ms)
444
+
445
+ コード
446
+
447
+ ``````
448
+
79
449
 
80
450
 
81
451
  ここに質問の内容を詳しく書いてください。

6

クラウドを使うか?

2018/11/08 12:17

投稿

neemo
neemo

スコア12

test CHANGED
File without changes
test CHANGED
@@ -72,7 +72,7 @@
72
72
 
73
73
  https://gabekore.org/mac-ruby-rails-overview
74
74
 
75
-
75
+ いや、むしろローカルでの環境構築をやめて、クラウド(AWS)を使った方がいいのですかね・・・かなりの素人なもので。。
76
76
 
77
77
  ```
78
78
 

5

初めからやり直し?

2018/11/08 08:40

投稿

neemo
neemo

スコア12

test CHANGED
File without changes
test CHANGED
@@ -68,7 +68,11 @@
68
68
 
69
69
  もしかして、仰る通り、見に行っているファイルが違うのかもしれません!!これまで編集していたroutes.rbのファイルは、/Users/eri/Desktop/Project/test_app/config/routes.rbにあるものです。どうりでいくら編集してもエラーになるわけですね。
70
70
 
71
- コマンドをさかのぼって見てみると、途中から、名称未設定フォルダ内を見に行っていたようです・・・しかしなぜいきなりこんなことになったのか分かりません・・初めからやり直した方がよろしいでしょうか??
71
+ コマンドをさかのぼって見てみると、途中から、名称未設定フォルダ内を見に行っていたようです・・・しかしなぜいきなりこんなことになったのか分かりません・・初めからやり直した方がよろしいでしょうか??次はこちらのサイトを見ながらやろうと思っています。
72
+
73
+ https://gabekore.org/mac-ruby-rails-overview
74
+
75
+
72
76
 
73
77
  ```
74
78
 

4

見に行くファイルが間違っていたかもしれません

2018/11/08 08:36

投稿

neemo
neemo

スコア12

test CHANGED
File without changes
test CHANGED
@@ -12,19 +12,29 @@
12
12
 
13
13
  routes.rbファイルは下記の通りです。endが間違っているのではないかということですが、間違っていますか?
14
14
 
15
+ ```ここに言語を入力
16
+
15
17
  Rails.application.routes.draw do
16
18
 
17
19
  root: 'top#index'
18
20
 
19
21
  end
20
22
 
23
+ ```
24
+
21
25
  また、https://techacademy.jp/magazine/7131 を見て対応したビューファイルがないといけないのかと思い、rails generate controller home index
22
26
 
23
27
  をしたのですが、また下記の通りエラーでした。
24
28
 
29
+ ```ここに言語を入力
30
+
25
31
  eri-no-MacBook-Air:test_app eri$ rails generate contoroller home index
26
32
 
27
33
  /Users/eri/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load': /Users/eri/Desktop/名称未設定フォルダ/test_app/config/routes.rb:59: syntax error, unexpected keyword_end, expecting end-of-input (SyntaxError)
34
+
35
+
36
+
37
+ ```
28
38
 
29
39
 
30
40
 

3

見に行くファイルが違っていたようです・・

2018/11/08 03:48

投稿

neemo
neemo

スコア12

test CHANGED
File without changes
test CHANGED
@@ -37,6 +37,30 @@
37
37
  (参考にしたサイト:https://web-camp.io/magazine/archives/16815)
38
38
 
39
39
  "もちろん、applicationコントローラ(app/controllers/application_controller.rb内のApplicationControllerクラス)にtopアクション(メソッド)がなければ、エラーが発生するでしょう。"
40
+
41
+
42
+
43
+ <追記3>
44
+
45
+ コマンド打ちました。下記の通りです。
46
+
47
+ ```ここに言語を入力
48
+
49
+ eri-no-MacBook-Air:test_app eri$ PWD
50
+
51
+ /Users/eri/Desktop/名称未設定フォルダ/test_app
52
+
53
+ eri-no-MacBook-Air:test_app eri$
54
+
55
+ ```
56
+
57
+
58
+
59
+ もしかして、仰る通り、見に行っているファイルが違うのかもしれません!!これまで編集していたroutes.rbのファイルは、/Users/eri/Desktop/Project/test_app/config/routes.rbにあるものです。どうりでいくら編集してもエラーになるわけですね。
60
+
61
+ コマンドをさかのぼって見てみると、途中から、名称未設定フォルダ内を見に行っていたようです・・・しかしなぜいきなりこんなことになったのか分かりません・・初めからやり直した方がよろしいでしょうか??
62
+
63
+ ```
40
64
 
41
65
 
42
66
 

2

indexアクションのせいですか?

2018/11/08 03:46

投稿

neemo
neemo

スコア12

test CHANGED
File without changes
test CHANGED
@@ -25,6 +25,18 @@
25
25
  eri-no-MacBook-Air:test_app eri$ rails generate contoroller home index
26
26
 
27
27
  /Users/eri/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load': /Users/eri/Desktop/名称未設定フォルダ/test_app/config/routes.rb:59: syntax error, unexpected keyword_end, expecting end-of-input (SyntaxError)
28
+
29
+
30
+
31
+ <追記2>
32
+
33
+ もしかして、routes.rbで書いたindexアクションが、controllers/application_controller.rb内にないからですかね・・・汗 今のところファイル内は空白です。
34
+
35
+ もしそうだとしたら、どう書けばいいんでしょう・・・
36
+
37
+ (参考にしたサイト:https://web-camp.io/magazine/archives/16815)
38
+
39
+ "もちろん、applicationコントローラ(app/controllers/application_controller.rb内のApplicationControllerクラス)にtopアクション(メソッド)がなければ、エラーが発生するでしょう。"
28
40
 
29
41
 
30
42
 

1

routes.rbファイルを確認しました。

2018/11/08 01:13

投稿

neemo
neemo

スコア12

test CHANGED
File without changes
test CHANGED
@@ -5,6 +5,26 @@
5
5
  このサイトにアクセスできません 0.0.0.0 で接続が拒否されました。
6
6
 
7
7
  とブラウザに出ます。
8
+
9
+
10
+
11
+ <追記1>
12
+
13
+ routes.rbファイルは下記の通りです。endが間違っているのではないかということですが、間違っていますか?
14
+
15
+ Rails.application.routes.draw do
16
+
17
+ root: 'top#index'
18
+
19
+ end
20
+
21
+ また、https://techacademy.jp/magazine/7131 を見て対応したビューファイルがないといけないのかと思い、rails generate controller home index
22
+
23
+ をしたのですが、また下記の通りエラーでした。
24
+
25
+ eri-no-MacBook-Air:test_app eri$ rails generate contoroller home index
26
+
27
+ /Users/eri/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load': /Users/eri/Desktop/名称未設定フォルダ/test_app/config/routes.rb:59: syntax error, unexpected keyword_end, expecting end-of-input (SyntaxError)
8
28
 
9
29
 
10
30