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

質問編集履歴

2

ファイル名追加

2019/06/12 12:17

投稿

san_you
san_you

スコア14

title CHANGED
File without changes
body CHANGED
@@ -22,8 +22,9 @@
22
22
  以下のコマンドを実行しました。
23
23
 
24
24
  そして以下のように編集を行いました。
25
- ```index.html
26
25
 
26
+ ```indexhtml
27
+
27
28
  <!DOCTYPE html>
28
29
  <html>
29
30
  <head>
@@ -45,7 +46,7 @@
45
46
  </html>
46
47
  ```
47
48
 
48
- ```renderer.js
49
+ ```rendererjs
49
50
  // This file is required by the index.html file and will
50
51
  // be executed in the renderer process for that window.
51
52
  // All of the Node.js APIs are available in this process.

1

修正

2019/06/12 12:17

投稿

san_you
san_you

スコア14

title CHANGED
File without changes
body CHANGED
@@ -1,3 +1,11 @@
1
+ 使用バージョン
2
+ ```cmd
3
+ PS D:\Electron_project\electron-quick-start> node -v
4
+ v10.16.0
5
+ PS D:\Electron_project\electron-quick-start> npm -v
6
+ 6.9.0
7
+ ```
8
+
1
9
  Electronのquickstartの手順に従い、適当なディレクトリを作成し
2
10
 
3
11
  ```cmd
@@ -14,8 +22,8 @@
14
22
  以下のコマンドを実行しました。
15
23
 
16
24
  そして以下のように編集を行いました。
25
+ ```index.html
17
26
 
18
- ```html
19
27
  <!DOCTYPE html>
20
28
  <html>
21
29
  <head>
@@ -29,9 +37,37 @@
29
37
  and Electron <span id="electron-version"></span>.
30
38
  <button>button</button>
31
39
  <!-- You can also require other files to run in this process -->
40
+
32
- <!-- 追加 -->
41
+ <!-- 追加 -->
33
42
  <script src="./renderer.js"></script>
34
43
 
35
44
  </body>
36
45
  </html>
37
- ```
46
+ ```
47
+
48
+ ```renderer.js
49
+ // This file is required by the index.html file and will
50
+ // be executed in the renderer process for that window.
51
+ // All of the Node.js APIs are available in this process.
52
+
53
+ // 追加
54
+ const fs = require('fs')
55
+ const path = require('path')
56
+ ```
57
+
58
+ そして
59
+ ```cmd
60
+ npx electron .
61
+ ```
62
+
63
+ 上記のコマンドを実行しElectronを実行すると以下のように開発者コンソールにエラーが表示されており、
64
+ エラーメッセージで検索をかけてもあまり参考になるような情報は得られませんでした。
65
+ ```
66
+ Uncaught ReferenceError: require is not defined
67
+ at renderer.js:5
68
+ ```
69
+
70
+ 公式のクイックスタートの手順に従ってソースのコメント通りにAPIを追加しただけなのですが
71
+ なにか見当違いなことをしているのでしょうか。
72
+
73
+ ご意見頂けると幸いです。