質問編集履歴
2
アドバイスの対応結果を反映
title
CHANGED
File without changes
|
body
CHANGED
@@ -202,9 +202,50 @@
|
|
202
202
|
|
203
203
|
```
|
204
204
|
### 補足情報(FW/ツールのバージョンなど)
|
205
|
+
windows 10
|
205
206
|
Rails 6.0.3.3
|
206
207
|
yarn 1.22.5
|
207
208
|
node v12.18.3
|
208
209
|
npm 6.14.6
|
209
210
|
|
210
|
-
|
211
|
+
### 対応1[①コンパイルが行われていない。]
|
212
|
+
リンク先.手順「rm -rf bin/webpack*」を作成中プロジェクトの階層で実行しましたが、
|
213
|
+
```
|
214
|
+
'rm' は、内部コマンドまたは外部コマンド、
|
215
|
+
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
|
216
|
+
```
|
217
|
+
|
218
|
+
上記のエラーで実行できませんでした。
|
219
|
+
やりたいことはwebpackerの再インストールなので、
|
220
|
+
「作成中プロジェクト\bin\webpack」のファイルを削除し、再実行をしましたが、
|
221
|
+
webpackが無いとのエラーが出たので、ファイルと戻し、
|
222
|
+
リンク先.手順「rails webpacker:install」「RAILS_ENV=test bundle exec rails webpacker:compile」の順に実行したところ、
|
223
|
+
'RAILS_ENV'に関してのエラーがでましたので、「bundle exec rails webpacker:compile」のみを実行しました。
|
224
|
+
結果、下記のエラーが出ている状況です。
|
225
|
+
```
|
226
|
+
Compiling...
|
227
|
+
Compilation failed:
|
228
|
+
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/webpacker-4.3.0/lib/webpacker/webpack_runner.rb:23:in `exec': No such file or directory - C:\サブデスクトップ\Ruby\ruby_lesson\tweet_app\node_modules\.bin/webpack (Errno::ENOENT)
|
229
|
+
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/webpacker-4.3.0/lib/webpacker/webpack_runner.rb:23:in `block in run'
|
230
|
+
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/webpacker-4.3.0/lib/webpacker/webpack_runner.rb:22:in `chdir'
|
231
|
+
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/webpacker-4.3.0/lib/webpacker/webpack_runner.rb:22:in `run'
|
232
|
+
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/webpacker-4.3.0/lib/webpacker/runner.rb:6:in `run'
|
233
|
+
from ./bin/webpack:17:in `block in <main>'
|
234
|
+
from ./bin/webpack:16:in `chdir'
|
235
|
+
from ./bin/webpack:16:in `<main>'
|
236
|
+
```
|
237
|
+
### 対応2[②yarnが古くてコンパイルが止まっている。]
|
238
|
+
リンク先.解決策「brew install yarn」を実行しましたが、
|
239
|
+
```
|
240
|
+
'brew' は、内部コマンドまたは外部コマンド、
|
241
|
+
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
|
242
|
+
```
|
243
|
+
上記のエラーで実行できませんでした。
|
244
|
+
Webで調べたところ、下記のコマンドでUPDATEをおこないました。
|
245
|
+
```
|
246
|
+
npm uninstall yarn -g
|
247
|
+
npm install yarn -g
|
248
|
+
|
249
|
+
```
|
250
|
+
その後、「bundle exec rails webpacker:compile」を実行しましたが、
|
251
|
+
①と同じエラーが出る状況です。
|
1
試したことを追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -88,8 +88,119 @@
|
|
88
88
|
```
|
89
89
|
|
90
90
|
### 試したこと
|
91
|
+
```
|
92
|
+
1. You want to set webpacker.yml value of compile to true for your environment
|
93
|
+
unless you are using the `webpack -w` or the webpack-dev-server.
|
91
|
-
|
94
|
+
2. webpack has not yet re-run to reflect updates.
|
95
|
+
3. You have misconfigured Webpacker's config/webpacker.yml file.
|
96
|
+
4. Your webpack configuration is not creating a manifest.
|
97
|
+
Your manifest contains:
|
98
|
+
```
|
99
|
+
下記のエラーアドバイスの中から「1」のみ試しました。
|
100
|
+
ですが、正しく修正できたかわかりません。
|
92
101
|
|
102
|
+
【1の修正内容】
|
103
|
+
※webpacker.yml...下から3行目
|
104
|
+
```
|
105
|
+
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
106
|
+
|
107
|
+
default: &default
|
108
|
+
source_path: app/javascript
|
109
|
+
source_entry_path: packs
|
110
|
+
public_root_path: public
|
111
|
+
public_output_path: packs
|
112
|
+
cache_path: tmp/cache/webpacker
|
113
|
+
check_yarn_integrity: false
|
114
|
+
webpack_compile_output: true
|
115
|
+
|
116
|
+
# Additional paths webpack should lookup modules
|
117
|
+
# ['app/assets', 'engine/foo/app/assets']
|
118
|
+
resolved_paths: []
|
119
|
+
|
120
|
+
# Reload manifest.json on all requests so we reload latest compiled packs
|
121
|
+
cache_manifest: false
|
122
|
+
|
123
|
+
# Extract and emit a css file
|
124
|
+
extract_css: false
|
125
|
+
|
126
|
+
static_assets_extensions:
|
127
|
+
- .jpg
|
128
|
+
- .jpeg
|
129
|
+
- .png
|
130
|
+
- .gif
|
131
|
+
- .tiff
|
132
|
+
- .ico
|
133
|
+
- .svg
|
134
|
+
- .eot
|
135
|
+
- .otf
|
136
|
+
- .ttf
|
137
|
+
- .woff
|
138
|
+
- .woff2
|
139
|
+
|
140
|
+
extensions:
|
141
|
+
- .svelte
|
142
|
+
- .mjs
|
143
|
+
- .js
|
144
|
+
- .sass
|
145
|
+
- .scss
|
146
|
+
- .css
|
147
|
+
- .module.sass
|
148
|
+
- .module.scss
|
149
|
+
- .module.css
|
150
|
+
- .png
|
151
|
+
- .svg
|
152
|
+
- .gif
|
153
|
+
- .jpeg
|
154
|
+
- .jpg
|
155
|
+
|
156
|
+
development:
|
157
|
+
<<: *default
|
158
|
+
compile: true
|
159
|
+
|
160
|
+
# Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
|
161
|
+
check_yarn_integrity: true
|
162
|
+
|
163
|
+
# Reference: https://webpack.js.org/configuration/dev-server/
|
164
|
+
dev_server:
|
165
|
+
https: false
|
166
|
+
host: localhost
|
167
|
+
port: 3035
|
168
|
+
public: localhost:3035
|
169
|
+
hmr: false
|
170
|
+
# Inline should be set to true if using HMR
|
171
|
+
inline: true
|
172
|
+
overlay: true
|
173
|
+
compress: true
|
174
|
+
disable_host_check: true
|
175
|
+
use_local_ip: false
|
176
|
+
quiet: false
|
177
|
+
pretty: false
|
178
|
+
headers:
|
179
|
+
'Access-Control-Allow-Origin': '*'
|
180
|
+
watch_options:
|
181
|
+
ignored: '**/node_modules/**'
|
182
|
+
|
183
|
+
|
184
|
+
test:
|
185
|
+
<<: *default
|
186
|
+
compile: true
|
187
|
+
|
188
|
+
# Compile test packs to a separate directory
|
189
|
+
public_output_path: packs-test
|
190
|
+
|
191
|
+
production:
|
192
|
+
<<: *default
|
193
|
+
|
194
|
+
# Production depends on precompilation of packs prior to booting for performance.
|
195
|
+
compile: true #←ここを「false」から「true」に修正
|
196
|
+
|
197
|
+
# Extract and emit a css file
|
198
|
+
extract_css: true
|
199
|
+
|
200
|
+
# Cache manifest.json for performance
|
201
|
+
cache_manifest: true
|
202
|
+
|
203
|
+
```
|
93
204
|
### 補足情報(FW/ツールのバージョンなど)
|
94
205
|
Rails 6.0.3.3
|
95
206
|
yarn 1.22.5
|