Windows10にelectronをインストールするメモ
環境
Windows10 home 64bit
node v17.1.0
npm 8.1.2
操作方法
1.package.json を作成します
C:\study\electron>npm init This utility will walk you through creating a package.json file. It only covers the most common items, and tries to guess sensible defaults. See `npm help init` for definitive documentation on these fields and exactly what they do. Use `npm install <pkg>` afterwards to install a package and save it as a dependency in the package.json file. Press ^C at any time to quit. package name: (electron) #全てenterキーを押下 version: (1.0.0) description: entry point: (index.js) test command: git repository: keywords: author: license: (ISC) About to write to C:\study\electron\package.json: { "name": "electron", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC" } Is this OK? (yes) y
2.electronをインストールします
C:\study\electron>npm install --save-dev electron added 86 packages, and audited 87 packages in 36s 5 packages are looking for funding run `npm fund` for details found 0 vulnerabilities
3.electronを起動します
C:\study\electron>npx electron Electron 17.1.2 - Build cross platform desktop apps with JavaScript, HTML, and CSS Usage: electron [options] [path] A path to an Electron app may be specified. It must be one of the following: - index.js file. - Folder containing a package.json file. - Folder containing an index.js file. - .html/.htm file. - http://, https://, or file:// URL. Options: -i, --interactive Open a REPL to the main process. -r, --require Module to preload (option can be repeated). -v, --version Print the version. -a, --abi Print the Node ABI version.