@@ -55,21 +55,45 @@ There are a few rules to follow for the purposes of this tutorial:
5555- _ author_ , _ license_ , and _ description_ can be any value, but will be necessary for
5656 [ packaging] [ packaging ] later on.
5757
58+ :::caution Install dependencies with a regular ` node_modules ` folder
59+
60+ Electron's packaging toolchain requires the ` node_modules ` folder to be physically on disk in the
61+ way that npm installs Node dependencies. By default, [ Yarn Berry] ( https://yarnpkg.com/ ) and
62+ [ pnpm] ( http://pnpm.io/ ) both use alternative installation strategies.
63+
64+ Therefore, you must set [ ` nodeLinker: node-modules ` ] ( https://yarnpkg.com/configuration/yarnrc#nodeLinker )
65+ in Yarn or [ ` nodeLinker: hoisted ` ] ( https://pnpm.io/settings#nodelinker ) in pnpm if you are using
66+ those package managers.
67+
68+ :::
69+
5870Then, install Electron into your app's ** devDependencies** , which is the list of external
5971development-only package dependencies not required in production.
6072
61- :::info Why is Electron a devDependency ?
73+ :::info Why is Electron a dev dependency ?
6274
63- This may seem counter-intuitive since your production code is running Electron APIs.
64- However, packaged apps will come bundled with the Electron binary, eliminating the need to specify
65- it as a production dependency.
75+ This may seem counter-intuitive since your production code is running Electron APIs. Under the hood,
76+ Electron's JavaScript API binds to a binary that contains its implementations. The packaging step for
77+ Electron handles the bundling of this binary, eliminating the need to specify it as a production
78+ dependency.
6679
6780:::
6881
6982``` sh npm2yarn
7083npm install electron --save-dev
7184```
7285
86+ ::: warning
87+
88+ In order to correctly install Electron, you need to ensure that its ` postinstall ` lifecycle
89+ script is able to run. This means avoiding the ` --ignore-scripts ` flag on npm and allowlisting
90+ ` electron ` to run build scripts on other package managers.
91+
92+ This is likely to change in a future version of Electron. See
93+ [ electron/rfcs #22 ] ( https://github.com/electron/rfcs/pull/22 ) for more details.
94+
95+ :::
96+
7397Your package.json file should look something like this after initializing your package
7498and installing Electron. You should also now have a ` node_modules ` folder containing
7599the Electron executable, as well as a ` package-lock.json ` lockfile that specifies
0 commit comments