electron environment construction:
1. Installation (global installation only needs once)
npm install -g electron / cnpm install -g electron (will not cnpm Baidu search cnpm)
2. Create a project and clone the project through git
1.cd into the corresponding project
2. Execute the following command
# Clone the repository of the example project
git clone https://github.com/electron/electron-quick-start
# Enter this warehouse
cd electron-quick-start
# Install dependencies and run
1, cnpm install, npm install installation dependencies
2. Run npm start
2. Create a project through electron-forge
electron-forge is equivalent to a scaffold for electron, which allows us to more easily create, run, and package electron projects.
1. Install electron-forge globally (only once)
npm install -g electron-forge / cnpm install -g electron-forge
2. Create a project electron-forge init my-new-app
Note: This step will install the module by default, if it fails, delete node_modules, re-cd to the project and run cnpm install or yarn
3. cd into the project
cd my-new-app
4. Run the project
npm start
3. Manually create a project through electron
1. Create a new folder (the folder cannot be Chinese)
2. Create a new index.html and a main.js
3. npm init generates a package.json configuration project metadata
Note that the main configured in package.json must be the entry js (main process)
4. electron. Running project