teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

エラー内容、environment.js及びapplication.jsソースコードを添付

2021/09/26 02:52

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -4,4 +4,64 @@
4
4
  Precompiling assets failed.
5
5
  とエラーが出てしまいます。
6
6
 
7
- 解決方法についてご教授願います。
7
+ 解決方法についてご教授願います。
8
+ 以下、エラー内容となっております。
9
+
10
+ ```
11
+ remote: Compilation failed:
12
+ remote: /tmp/build_397464b6/config/webpack/environment.js:5
13
+ remote: new.webpack.ProvidePlugin({
14
+ remote: ^^^^^^^
15
+ remote:
16
+ remote: SyntaxError: Unexpected identifier
17
+ .
18
+ .
19
+ .
20
+ remote: !
21
+ remote: ! Precompiling assets failed.
22
+ remote: !
23
+ remote: ! Push rejected, failed to compile Ruby app.
24
+ remote:
25
+ remote: ! Push failed
26
+ remote: !
27
+ remote: ! ## Warning - The same version of this code has already been built: cfb0dac017b63dbf1ec9ebf4f9c1b164731fbab8
28
+ remote: !
29
+ remote: ! We have detected that you have triggered a build from source code with version cfb0dac017b63dbf1ec9ebf4f9c1b164731fbab8
30
+ remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
31
+ remote: !
32
+ remote: ! If you are developing on a branch and deploying via git you must run:
33
+ ```
34
+
35
+ 以下、エラーを引き起こしている(?)該当ファイルになります。
36
+ environment.js
37
+ ```environment.js
38
+ const { environment } = require('@rails/webpacker')
39
+
40
+ const webpack = require('webpack')
41
+ environment.plugins.prepend('Provide',
42
+ new webpack.ProvidePlugin ( {
43
+ $: 'jquery/src/jquery',
44
+ jQuery: 'jquery/src/jquery'
45
+ } )
46
+ )
47
+
48
+ module.exports = environment
49
+ ```
50
+
51
+ application.js
52
+ ```application.js
53
+
54
+ // This file is automatically compiled by Webpack, along with any other files
55
+ // present in this directory. You're encouraged to place your actual application logic in
56
+ // a relevant structure within app/javascript and only use these pack files to reference
57
+ // that code so it'll be compiled.
58
+
59
+ import Rails from "@rails/ujs"
60
+ import Turbolinks from "turbolinks"
61
+ import * as ActiveStorage from "@rails/activestorage"
62
+ import "channels"
63
+
64
+ Rails.start()
65
+ Turbolinks.start()
66
+ ActiveStorage.start()
67
+ ```