electron-forge / electron-forge-docs Goto Github PK
View Code? Open in Web Editor NEW:electron: Mirror for Electron Forge's GitBook documentation
Home Page: https://electronforge.io
:electron: Mirror for Electron Forge's GitBook documentation
Home Page: https://electronforge.io
sh-5.1$ flatpak-spawn --host yarn make
yarn run v1.22.5
$ electron-forge make
✔ Checking your system
✔ Resolving Forge Config
We need to package your application before we can make it
✔ Preparing to Package Application for arch: x64
✔ Preparing native dependencies
✔ Packaging Application
Making for the following targets: flatpak
✖ Making for target: flatpak - On platform: linux - For arch: x64
An unhandled error has occurred inside Forge:
An error occured while making for target: flatpak
flatpak failed with status code 1
Error: flatpak failed with status code 1
at ChildProcess.child.on (../node_modules/@malept/flatpak-bundler/index.js:71:16)
at ChildProcess.emit (events.js:198:13)
at ChildProcess.EventEmitter.emit (domain.js:448:20)
at maybeClose (internal/child_process.js:982:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
When I use electron ./
this is work, but when I use electron-forge start
this become unknown property name.
const createWindow = () => {
const win = new BrowserWindow({
width: 1600,
height: 700,
webPreferences: {
preload: path.join(__dirname, 'rpc/bridge.js'),
// contextIsolation: false,
nodeIntegration: false,
// plugins: true,
},
});
win.loadURL("http://127.0.0.1:889/")
};
The latest electron-forge documention refers to the config.forge
path in package.json
containing packagerConfig
and makers
, whereas older versions of "Forge Config" contain electronPackagerConfig
, make_targets
and a variety of others like electronRebuildConfig
and electronInstaller*
.
The latest doco on npm refers to the older configuration format:
{
"make_targets": {
"win32": ["squirrel"], // An array of win32 make targets
"darwin": ["zip", "dmg"], // An array of darwin make targets
"linux": ["deb", "rpm", "flatpak", "snap"] // An array of linux make targets
},
"electronPackagerConfig": {},
"electronRebuildConfig": {},
"electronWinstallerConfig": {},
"electronInstallerDMG": {},
"electronInstallerFlatpak": {},
"electronInstallerDebian": {},
"electronInstallerRedhat": {},
"electronInstallerSnap": {}
}
which is inconsistent with the doco at www.electronforge.io
package.json
, module.exports
and forge.config.js
format entries. Whilst it is nice that there are so many ways of achieving configuration, it might be better to have a consistent format for all the examples to avoid confusion.For my own project, I migrated by kind of figuring it out. I like the new format better. Here is what I did to my package.json
:
electronPackagerConfig
-> packagerConfig
make_targets
, electronRebuildConfig
and all the electronInstaller*
entries and replaced them with a single makers
entry e.g. "config": {
"forge": {
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "myproject"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "@electron-forge/maker-deb",
"config": {},
"platforms": [
"linux"
]
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
}
]
In addition, for what its worth, I read all the config examples for all the makers and compiled this list of possible keywords in each makers object:
- name
- platforms (a list of strings)
- config
- name
- background
- format
- options
- maintainer
- homepage
- categories
- mimeType
- keychain
- features
- audio
- mpris
- webgl
- summary
- certificateFile
- certificatePassword
As I mentioned in point 4 above, it would be helpful to have some indication of what exactly is allowed in each maker config object, and how that meshes (or not) with electron-packager documentation. Running $(npm bin)/electron-packager --help
didn't, at first glance, give me any meshing ideas.
On the CLI, options such as --arch
and --platform
can be provided to electron-forge publish
and will fall through to the make operation, but this is not currently documented. In particular those two options should probably be explicitly called out, but also a general call out that options pass through is important.
I have read all the document but I could not find any information to how can I set provider to generic in electron forge publish config
https://www.electronforge.io/config/plugins/webpack#configuration says:
The complete config options are available at
WebpackPluginConfig
.
but i can't find any documentation on nodeIntegration
on WebpackPluginConfig
. i am trying to use openpgp.js and it isn't properly detecting which environment to run in and is giving an error. i'd like to disable nodeIntegration
for this package.
I had high hopes that "Debugging your Electron main process through VS Code is ridiculously easy with Forge. Simply add this as a launch config in VSCode and you're good to go."
However, I am not finding it so.
The blurb says create a "launch.config" file (edit: It didn't, I assumed this.). This doesn't seem to do anything. I also tried a launch.json (what I have used before?), but when launching the debugger I get:
C:\Program Files\nodejs\node.exe .\src\index.js
Debugger attached.
Waiting for the debugger to disconnect...
c:\Users\Gordon\Documents\Applications\ElectronForgeTest\my-app\src\index.js:26
app.on('ready', createWindow);
^
TypeError: Cannot read property 'on' of undefined
at Object.<anonymous> (c:\Users\Gordon\Documents\Applications\ElectronForgeTest\my-app\src\index.js:26:5)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
Process exited with code 1
null: Uncaught TypeError: Cannot read property 'on' of undefined
Yet, using the command line, the auto generated app runs fine.
Perhaps in my ignorance I am not doing what I should.
Could you please do a step by step. Where do I put the launch.config? In the root, in .vscode?
When I click on the debugging icon it asks for Run and Debug ( as well as other options) I would have thought (in my ignorance) that it would pick up the launch.config and start debugging.
If it displays select environment, what do I select? Node, Node(legacy)? I would have hoped that Electron would show up?
Sorry, I am very conscious that I don't understand the process, but it certainly isn't trivial!! :)
The path to the root of my application is 44 characters long. Running npm run make
, it dies with:
✖ Making for target: squirrel - On platform: win32 - For arch: x64
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
How can I either change the location of the output or otherwise get past this error without moving my whole project?
package.json
{ "name": "zwt", "productName": "zwt", "version": "", "description": "zwt", "main": "src/index.js", "scripts": { "start": "electron-forge start", "package": "electron-forge package", "make": "electron-forge make", "publish": "electron-forge publish", "lint": "eslint src --color" }, "keywords": [], "author": "cxj", "license": "mit", "config": { "forge": "./forge.config.js" }, "dependencies": { "electron-compile": "^6.4.4", "electron-squirrel-startup": "^1.0.0" }, "devDependencies": { "babel-plugin-transform-async-to-generator": "^6.24.1", "babel-preset-env": "^1.7.0", "babel-preset-react": "^6.24.1", "electron": "^12.0.1", "electron-forge": "^5.2.4", "electron-prebuilt-compile": "8.2.0", "eslint": "^3.19.0", "eslint-config-airbnb": "^15.1.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jsx-a11y": "^5.1.1", "eslint-plugin-react": "^7.22.0" } }
project url:https://github.com/tkggusraqk/electron-demo.git
Frankly, I don't know whether to post this issue on forge or electron-forge-docs, but there's a misunderstanding in both repos.
The instructions for Debugging with VS Code will not work because of the way electron-forge-vscode-nix
works.
The issue is with the following line:
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron-forge-vscode-nix",
The problem is that ${workspaceFolder}/node_modules/.bin/electron-forge-vscode-nix
is a symlink to ${workspaceFolder}/node_modules/@electron-forge/cli/script/vscode.sh
and it tries to determine the project directory by referencing it relative to it's own path. Thus, the symlink and the original script will run electron-forge-start
in different working directories.
Replacing the above line with the following will work:
"runtimeExecutable": "${workspaceFolder}/node_modules/@electron-forge/cli/script/vscode.sh",
I'm not sure if the Windows version of this option has this issue.
Installing support for tailwind-css requires manual modifications of webpack configuration. Add appropriate instructions for making these changes.
No matter which files I changed, Webpack watcher will refresh the page upon update. However, the preload.ts
doesn't get loaded during this process. If type rs
in the console as mentioned in the docs, it still doesn't load. It only works the first time the app is luanched.
Error:
Unable to load preload script: ~/.webpack/renderer/main_window/preload.js
When following the instructions for the React with Typescript framework integration guide, we get the following eslint error:
Unable to resolve path to module './app'. eslint(import/no-unresolved)
To reproduce:
yarn create electron-app my-new-app --template=typescript-webpack
cd my-new-app
"jsx": "react"
to tsconfig.json
under "compilerOptions"
yarn add react react-dom
yarn add --dev @types/react @types/react-dom
src/app.tsx
file from the guideimport './app'
line to src.renderer.ts
yarn lint
to view the error aboveI was able to resolve this by adding "plugin:import/typescript"
to the .eslintrc.json
under the "extends"
key. I'm working on an edit to the docs for a PR.
I just read the getting started page and tried out the command for using the typescript template but it just ended up creating a project using the base template.
This command from the getting started page just creates a project with the base template:
npm init electron-app@latest my-app -- --template=webpack-typescript
Instead of that, this works, without the double dashes prior to the options:
npm init electron-app@latest my-app --template=webpack-typescript
I'm using node v14.19.0 and npm 6.14.16 and my shell is zsh 5.8 (x86_64-apple-darwin21.0)
The Auto Unpack Native Modules page (see https://www.electronforge.io/config/plugins/auto-unpack-natives) seems outdated. No information about how to setup it with webpack. And what is the real difference with or without?
Since the repository was moved, merged PRs aren't showing up in GitBook, and changes made inside the GitBook UI aren't being synced here. This means that the docs cannot be changed in either place until we figure out how to fix that.
Hi,
I'm a novice to JavaScript/Electron development and have been working on getting my first Electron app up and running using the Electron Forge v6 beta and this documentation.
It's very possible it was just due to my lack of experience/knowledge regarding the Node environment, but it took me hours of reading and web searching to figure out that the reason I was getting the error "publisher target not found" when trying to use Electron Forge to publish to GitHub releases was because I had configured the publisher in package.json but hadn't installed the @electron-forge/publisher-github NPM package as well.
I've double checked the documentation trying to find any mention of this, and restarted a test project from scratch following the "Getting Started" section to try to confirm it wasn't that I just missed something.
Is there a step I should've taken to install that dependency after configuring the publisher in package.json (another execution electron-forge init or something) that I missed in the existing documentation? Or is this the sort of a thing a more experienced dev would've known to go install as soon as they read the documentation regarding configuring the publisher in package.json?
Either way, just thought I'd ask for my own benefit and maybe that of anyone else going through something similar.
Thanks!
yarn create electron-app my-new-app --template=typescript-webpack
- ok
ok
> [email protected] start /Users/***/dev/my-new-app
> electron-forge start
✔ Checking your system
✔ Locating Application
✔ Preparing native dependencies
✔ Compiling Main Process Code
✖ Launch Dev Servers
An unhandled error has occurred inside Forge:
Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
- options has an unknown property 'historyApiFallback'. These properties are valid:
object { mimeTypes?, writeToDisk?, methods?, headers?, publicPath?, stats?, serverSideRender?, outputFileSystem?, index? }
ValidationError: Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
- options has an unknown property 'historyApiFallback'. These properties are valid:
object { mimeTypes?, writeToDisk?, methods?, headers?, publicPath?, stats?, serverSideRender?, outputFileSystem?, index? }
at validate (/Users/***/dev/my-new-app/node_modules/webpack-dev-middleware/node_modules/schema-utils/dist/validate.js:104:11)
at wdm (/Users/***/dev/my-new-app/node_modules/webpack-dev-middleware/dist/index.js:31:29)
at /Users/***/dev/my-new-app/node_modules/@electron-forge/plugin-webpack/src/WebpackPlugin.ts:292:22
at processTicksAndRejections (internal/process/task_queues.js:93:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `electron-forge start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/***/.npm/_logs/2021-05-20T08_51_47_234Z-debug.log
I cannot find the reason why it fails (and searching the issue in internet also did not help)
mabuhay planet earth unify all
Hello,
I am trying to create windows installer (squirrel, msi) for my large application which size is about more than 4gb (i had to embed many mp4 files into asar file) but i cannot, the setup.exe that is created is corrupted..if i delete embedded mp4 files everything is ok...
Is there any solution?
> Hi,
I'm a novice to JavaScript/Electron development and have been working on getting my first Electron app up and running using the Electron Forge v6 beta and this documentation.
It's very possible it was just due to my lack of experience/knowledge regarding the Node environment, but it took me hours of reading and web searching to figure out that the reason I was getting the error "publisher target not found" when trying to use Electron Forge to publish to GitHub releases was because I had configured the publisher in package.json but hadn't installed the @electron-forge/publisher-github NPM package as well.
I've double checked the documentation trying to find any mention of this, and restarted a test project from scratch following the "Getting Started" section to try to confirm it wasn't that I just missed something.
Is there a step I should've taken to install that dependency after configuring the publisher in package.json (another execution electron-forge init or something) that I missed in the existing documentation? Or is this the sort of a thing a more experienced dev would've known to go install as soon as they read the documentation regarding configuring the publisher in package.json?
Either way, just thought I'd ask for my own benefit and maybe that of anyone else going through something similar.
Thanks!
bug fix auto arrange wifi
Originally posted by @Kingodbug in #1 (comment)
使用谷歌翻译插件时,代码块也被翻译了,请对涉及代码块的dom添加translate=’no‘属性
I am glad to use electron-forge to build my electron apps.
But it seems that there are not description about how to build an uninst.exe in docs.
If the path splitting character "/" is also guaranteed under windows, it is recommended that the reader be explicitly informed here.
I need to open a second electron browserWindow, and I tried to configure in forge.config.js two different renderer processes:
/* eslint-disable @typescript-eslint/no-var-requires */
// Forge Configuration
const path = require('path');
const rootDir = process.cwd();
module.exports = {
// Packager Config
packagerConfig: {
// Create asar archive for main, renderer process files
asar: true,
},
// Forge Makers
makers: [
{
// Squirrel.Windows is a no-prompt, no-hassle, no-admin method of installing
// Windows applications and is therefore the most user friendly you can get.
name: '@electron-forge/maker-squirrel',
config: {
name: 'trial_ipc_2020',
},
},
{
// The Zip target builds basic .zip files containing your packaged application.
// There are no platform specific dependencies for using this maker and it will run on any platform.
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
// The deb target builds .deb packages, which are the standard package format for Debian-based
// Linux distributions such as Ubuntu.
name: '@electron-forge/maker-deb',
config: {},
},
{
// The RPM target builds .rpm files, which is the standard package format for
// RedHat-based Linux distributions such as Fedora.
name: '@electron-forge/maker-rpm',
config: {},
},
],
// Forge Plugins
plugins: [
[
// The Webpack plugin allows you to use standard Webpack tooling to compile both your main process code
// and your renderer process code, with built in support for Hot Module Reloading in the renderer
// process and support for multiple renderers.
'@electron-forge/plugin-webpack',
{
// Main process webpack configuration
mainConfig: path.join(rootDir, 'tools/webpack/webpack.main.js'),
// Renderer process webpack configuration
renderer: {
// Configuration file path
config: path.join(rootDir, 'tools/webpack/webpack.renderer.js'),
// Entrypoints of the application
entryPoints: [
{
// React Hot Module Replacement (HMR)
rhmr: 'react-hot-loader/patch',
// HTML index file template
html: path.join(rootDir, 'src/index.html'),
// Renderer
// https://www.electronjs.org/docs/tutorial/quick-start#main-and-renderer-processes
// https://github.com/electron-userland/electron-webpack/issues/47
//js: path.join(rootDir, 'src/renderer.ts'),
js: path.join(rootDir, ['src/renderer.ts', 'src/renderer-2.ts']),
// Main Window
name: 'main_window',
// Preload
preload: {
js: path.join(rootDir, 'src/preload.ts'),
},
},
],
},
},
],
],
};
And got this error:
(base) marco@pc01:~/webMatters/electronMatters/trial-ipc$ yarn start
yarn run v1.22.5
$ cross-env NODE_ENV=development electron-forge start
✔ Checking your system
✔ Locating Application
Failed to load: /home/marco/webMatters/electronMatters/trial-ipc/tools/forge/forge.config.js
An unhandled rejection has occurred inside Forge:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array
at validateString (internal/validators.js:121:11)
at Object.join (path.js:1039:7)
at Object.<anonymous> (/home/marco/webMatters/electronMatters/trial-ipc/tools/forge/forge.config.js:66:24)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
at Module.load (internal/modules/cjs/loader.js:1050:32)
at Function.Module._load (internal/modules/cjs/loader.js:938:14)
at Module.require (internal/modules/cjs/loader.js:1090:19)
at require (internal/modules/cjs/helpers.js:75:18)
at _default (/home/marco/webMatters/electronMatters/trial-ipc/node_modules/@electron-forge/core/src/util/forge-
config.ts:123:21)
at _default (/home/marco/webMatters/electronMatters/trial-ipc/node_modules/@electron-forge/core/src/api/start.ts:37:23)
at /home/marco/webMatters/electronMatters/trial-ipc/node_modules/@electron-forge/cli/src/electron-forge-start.ts:59:19 {
code: 'ERR_INVALID_ARG_TYPE'
}
Electron Forge was terminated. Location:
{}
error Command failed with exit code 1.
The current instructions state that they only have been tested with react 17. Following them with react 18 results in code that does not work with react 18.
If a preload script is used.
"plugins": [
[
"@electron-forge/plugin-webpack",
{
"mainConfig": "./webpack.main.config.js",
"renderer": {
"config": "./webpack.renderer.config.js",
"entryPoints": [
{
"html": "./src/renderer/index.html",
"js": "./src/renderer/index.ts",
"name": "main_window",
"preload": {
"js": "./src/main/preload.ts"
}
}
]
}
}
]
]
then the plugins from webpack.renderer.config.js
will run twice. For example if a copy files plugin is used
new CopyPlugin({
patterns: [{ from: "./src/renderer/assets", to: "assets" }],
}),
Then the assets folder will be copied twice:
Can this problem be overcome?
This repository is missing a license. Of course, I can submit one via a PR but as I don't own this code, I wouldn't want to make assumptions.
Hello
While looking into the WiX config it point out to this link
https://js.electronforge.io/maker/wix/interfaces/makerwixconfig.html
Which gives a 404
I think the guidance on how to deal with external node modules when using webpack could use some clarification. Specifically, my application uses serialport.io. To get this to work in dev, I had to add it as an external to webpack config:
externals: {
serialport: "require('serialport')"
},
This however, did not work when building the application as it would then complain about serialport not being found. Looking through the build files, serialport was no where to be found.
After spending a few days on the issue, I finally found a stackoverflow post from a few months ago which describes the issue:
If a module is listed as external, it will be pruned during the packaging process. So in your forge config, you need to include hooks during your building process.
Even just having that quote somewhere in the build documentation would be very helpful.
After adding the hook to run npm install
after prune, the built app runs without any issue.
hooks: {
packageAfterPrune: async (forgeConfig, buildPath) => {
console.log(buildPath);
return new Promise((resolve, reject) => {
const npmInstall = spawn("npm", ["install", "serialport"], {
cwd: buildPath,
stdio: "inherit",
shell: true,
});
npmInstall.on("close", (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error("process finished with error code " + code));
}
});
npmInstall.on("error", (error) => {
reject(error);
});
});
},
},
This, however, seems to install all the dependencies in package.json, not just the serialport module. This causes packaging to take a lot longer as theres lots of files to now copy over. Guidance on what the recommended approach to this would be much appreciated.
I think a large source of confusion for me (and a lot of other people from the posts I've read) is assuming everything is being bundled automatically. Theres a lot of verbage in the docs currently saying this should mainly work out of the box but for the things that don't, I haven't been able to find any official documentation on what to do.
Getting Started
currently mentions the webpack
and webpack-typescript
templates as the only templates, leaving out vite.
@electron-forge/plugin-webpack : "version": "6.0.0-beta.54".
package.json
{
"name": "cb-project-manager",
"productName": "cb-project-manager",
"version": "1.0.0",
"description": "My Electron application description",
"main": ".webpack/main",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "eslint --ext .ts,.tsx ."
},
"keywords": [],
"author": {
"name": "kuntang",
"email": "[email protected]"
},
"license": "MIT",
"dependencies": {
"electron-squirrel-startup": "^1.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@electron-forge/cli": "^6.1.1",
"@electron-forge/maker-deb": "^6.1.1",
"@electron-forge/maker-rpm": "^6.1.1",
"@electron-forge/maker-squirrel": "^6.1.1",
"@electron-forge/maker-zip": "^6.1.1",
"@types/react": "^18.0.38",
"@types/react-dom": "^18.0.11",
"@types/webpack": "^5.28.1",
"electron": "24.1.2"
}
}
The docs use a different format than the template to define the webpack plugin. When using the WebpackPlugin
constructor, the contextIsolation
option is not available and the docs state it must be set in addition to the BrowserWindow webPreferences.
const config: ForgeConfig = {
makers: [new MakerDeb({}), new MakerRpm({}), new MakerSquirrel({}), new MakerZIP({}, ['darwin'])],
plugins: [
new WebpackPlugin({
mainConfig,
renderer: {
config: rendererConfig,
contextIsolation: true, // 👈 this is a TS error
entryPoints: [
{
html: './frontend/public/index.html',
js: './frontend/src/index.tsx',
name: 'main_window',
preload: {
config: preloadConfig,
js: './electron/src/preload.ts',
},
},
],
},
}),
],
};
https://js.electronforge.io/maker/squirrel/interfaces/makersquirrelconfig#iconurl
This references iconUrl
, but not icon
.
Because iconUrl
expects a remote http/https url string, builds will fail when pointed to a local file.
see: electron-userland/electron-installer-windows#55 (comment)
This should note that only one of [iconUrl, icon]
should be used, and icon
for local app icon files.
With the power of rechoir, you can write your Forge configuration in any language you really want to. In practice, this is often just TypeScript or JavaScript, but it'd be great to have this documented.
ERROR CREATING PROJECT USING YARN THROUGH COREPACK.
franky@localhost Workspace % yarn create electron-app my-app
➤ YN0000: ┌ Resolution step
➤ YN0061: │ @npmcli/move-file@npm:2.0.1 is deprecated: This functionality has been moved to @npmcli/fs
➤ YN0000: └ Completed in 10s 707ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed
➤ YN0000: Done with warnings in 10s 934ms
✔ Locating custom template: "base"
✔ Initializing directory
✔ Preparing template
✔ Initializing template
⚠ Installing template dependencies
✔ Installing production dependencies
✔ Installing development dependencies
✖ Failed to install modules: ["electron-squirrel-startup"]
With output: Command failed with a non-zero return code (1):
yarn add electron-squirrel-startup
Internal Error: Your application tried to access corepack, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Required package: corepack (via "corepack/package.json")
Required by: /Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/
Require stack:
- /Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/corepack.js
- /Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/yarn.js
Required package: corepack (via "corepack/package.json")
Required by: /Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/
Require stack:
- /Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/corepack.js
- /Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/yarn.js
at require$$0.Module._resolveFilename (/private/var/folders/c6/f0f1bg014dz3c3lwz1yyh7v40000gn/T/xfs-da90763c/dlx-31818/.pnp.cjs:12712:13)
at Function.resolve (node:internal/modules/cjs/helpers:116:19)
at runVersion (/Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/corepack.js:44173:68)
at async executePackageManagerRequest (/Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/corepack.js:44824:10)
at async BinaryCommand.validateAndExecute (/Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/corepack.js:42237:22)
at async Cli.run (/Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/corepack.js:43227:18)
at async main (/Users/franky/.nvm/versions/node/v18.16.0/lib/node_modules/corepack/dist/corepack.js:44863:12)
as per boilerplate instruction, node integration not working.
I am not sure if this is the right place to post this.
main.js
and enable the nodeIntegration
nodeIntegration: true
I'm using electron-forge to Package and distribute my application with my Win 10 Home Edtion PC. When I typed
npm run make
and pressed Enter, I get an error like:
[email protected] make
electron-forge make
✔ Checking your system
✔ Resolving Forge Config
We need to package your application before we can make it
✔ Preparing to Package Application for arch: x64
✔ Preparing native dependencies
✔ Packaging Application
Making for the following targets: squirrel
✖ Making for target: squirrel - On platform: win32 - For arch: x64
An unhandled error has occurred inside Forge:
An error occured while making for target: squirrel
Failed with exit code: 4294967295
Output:
System.AggregateException: 发生一个或多个错误。 ---> System.ComponentModel.Win32Exception: 系统找不到指定的文件。
在 System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
在 System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
在 Squirrel.Utility.d__11.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 Squirrel.Utility.d__23.MoveNext()
--- 内部异常堆栈跟踪的结尾 ---
在 System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
在 Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func2 releaseNotesProcessor, Action
1 contentsPostProcessHook)
在 Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
在 Squirrel.Update.Program.executeCommandLine(String[] args)
在 Squirrel.Update.Program.main(String[] args)
在 Squirrel.Update.Program.Main(String[] args)
---> (内部异常 #0) System.ComponentModel.Win32Exception (0x80004005): 系统找不到指定
的文件。
在 System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
在 System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
在 Squirrel.Utility.d__11.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 Squirrel.Utility.d__23.MoveNext()<---
Error: Failed with exit code: 4294967295
Output:
System.AggregateException: 发生一个或多个错误。 ---> System.ComponentModel.Win32Exception: 系统找不到指定的文件。
在 System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
在 System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
在 Squirrel.Utility.d__11.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 Squirrel.Utility.d__23.MoveNext()
--- 内部异常堆栈跟踪的结尾 ---
在 System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
在 Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func2 releaseNotesProcessor, Action
1 contentsPostProcessHook)
在 Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, Boolean packageAs64Bit, String frameworkVersion, Boolean generateDeltas)
在 Squirrel.Update.Program.executeCommandLine(String[] args)
在 Squirrel.Update.Program.main(String[] args)
在 Squirrel.Update.Program.Main(String[] args)
---> (内部异常 #0) System.ComponentModel.Win32Exception (0x80004005): 系统找不到指定的文件。
在 System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
在 System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
在 Squirrel.Utility.d__11.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 Squirrel.Utility.d__23.MoveNext()<---
at ChildProcess. (E:\Workspaces\VSCode\exp-storyofgrowingup-web\exp-story-electron\node_modules\electron-winstaller\src\spawn-promise.ts:52:16)
at ChildProcess.emit (node:events:390:28)
at ChildProcess.emit (node:domain:475:12)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
The dry run feature for publish is under-documented, it should explain in more detail how it works, and how it can be used for publishing artifacts for multiple artifacts built on different CI runners.
* Could not resolve host: www.electronforge.io
* Closing connection 0
curl: (6) Could not resolve host: www.electronforge.io
The website provides no clear information on what electron-forge depends on.
For example yarn 2 is required to run:
yarn dlx @electron-forge/cli import
Hi!
I just want to know more about .compilerc file and how to manage it.
Thank you
when I try to run electron-forge start or electron-forge make in my react app the output is just a blank screen, its my first time using elctron forge and I don´t know if my package.json is configured correctly or my start.js which I use to show the electron app window
package.json:
{
"name": "playland_si",
"version": "0.1.0",
"author": "Stringcore",
"description": "Sistema para la guardería Playland",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"ag-grid-community": "^23.1.0",
"ag-grid-react": "^23.1.0",
"axios": "^0.19.2",
"electron-compile": "^6.4.4",
"electron-squirrel-startup": "^1.0.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.19.0",
"moment": "^2.25.3",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"reactjs-popup": "^1.5.0",
"reactstrap": "^8.4.1"
},
"main": "src/start.js",
"scripts": {
"start": "electron-forge start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"electron": "electron .",
"electron-start": "node src/start-react",
"react-start": "react-scripts start",
"pack": "build --dir",
"dist": "npm run build && build",
"postinstall": "install-app-deps",
"package": "electron-forge package",
"make": "electron-forge make"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"electron-forge": "^5.2.4",
"electron-prebuilt-compile": "8.2.0"
},
"build": {
"appId": "playlandsi-V1",
"win": {
"icon": "build/icon.ico"
},
"directories": {
"buildResources": "public"
}
},
"config": {
"forge": {
"make_targets": {
"win32": [
"squirrel"
],
"darwin": [
"zip"
],
"linux": [
"deb",
"rpm"
]
},
"electronPackagerConfig": {
"packageManager": "npm",
"icon": "build/icon.ico"
},
"electronWinstallerConfig": {
"name": "playland_si",
"icon": "build/icon.ico"
},
"electronInstallerDebian": {},
"electronInstallerRedhat": {},
"github_repository": {
"owner": "",
"name": ""
},
"windowsStoreConfig": {
"packageName": "",
"name": "playland_si"
}
}
}
}
start.js:
const { app, BrowserWindow } = require('electron')
const path = require('path')
const url = require('url')
let mainWindow
function createWindow() {
mainWindow = new BrowserWindow({
minWidth: 1280,
minHeight: 720,
icon: __dirname + '/images/IconApp.png',
backgroundColor: "#24314c",
webPreferences: {
nodeIntegration: true
}
})
mainWindow.loadURL(
process.env.ELECTRON_START_URL ||
url.format({
pathname: path.join(__dirname, '/../public/index.html'),
protocol: 'file:',
slashes: true
})
)
mainWindow.on('closed', () => {
mainWindow = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (mainWindow === null) {
createWindow()
}
})
it also shows the following warnings
it works correctly when i use npm run electron-start
Currently, the generated package.json
for the "Typescript + Webpack" template uses the following lint script in the package.json
:
"lint": "eslint --ext .ts ."
I think it could be a good addition to the React framework integration guide to let the user know they should update this script to include the .tsx
extension as well.
New package.json
lint script:
"lint": "eslint --ext .ts,.tsx ."
installed und run -- as in the docs at https://www.electronforge.io/advanced/extending-electron-forge
electron-forge
would be missing ... so:dev
depnotepad package.json
and removed the ^
in front of the version and npm start
again
npm run package
... it compiles fine, but crashes on start.A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.