我目前正在尝试构建我的 Electron 应用程序。
为此,我正在使用 Electron Forge。
当我运行 npm start 时一切正常,但是当我尝试使用 npm run make 构建它时
我收到以下错误行:
An unhandled rejection has occurred inside Forge:
[Error: ENOENT: no such file or directory, rename 'C:\Users\RENERE~1\AppData\Local\Temp\electron-packager\win32-x64\yt-downloader-win32-x64\electron.exe' -> 'C:\Users\RENERE~1\AppData\Local\Temp\electron-packager\win32-x64\yt-downloader-win32-x64\yt-downloader.exe'] {
errno: -4058,
code: 'ENOENT',
syscall: 'rename',
path: 'C:\\Users\\RENERE~1\\AppData\\Local\\Temp\\electron-packager\\win32-x64\\yt-downloader-win32-x64\\electron.exe',
dest: 'C:\\Users\\RENERE~1\\AppData\\Local\\Temp\\electron-packager\\win32-x64\\yt-downloader-win32-x64\\yt-downloader.exe'
}
这是 package.json 文件:
{
"name": "yt-downloader",
"productName": "yt-downloader",
"version": "1.0.0",
"description": "Download from Youtube",
"main": "index.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "Remling97",
"email": "[email protected]"
},
"license": "MIT",
"config": {
"forge": {
"packagerConfig": {},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "yt_downloader"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "@electron-forge/maker-deb",
"config": {}
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
}
]
}
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0",
"ytdl-core": "^2.0.0",
"ytpl": "^0.1.20"
},
"devDependencies": {
"@electron-forge/cli": "6.0.0-beta.50",
"@electron-forge/maker-deb": "6.0.0-beta.50",
"@electron-forge/maker-rpm": "6.0.0-beta.50",
"@electron-forge/maker-squirrel": "6.0.0-beta.50",
"@electron-forge/maker-zip": "6.0.0-beta.50",
"electron": "8.1.0"
}
}
我真的无法在网上找到为什么会发生这种情况的答案。谁能帮我?我已经尝试重新安装 Electron , Electron 锻造和 nodejs 没有任何效果。
最佳答案
如果其他人遇到此错误并且找不到解决方案:
关于node.js - Electron 锻造 : Error: ENOENT: no such file or directory,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60590222/