我刚刚创建了电子反应应用程序,还实现了自动更新功能。但出乎意料的是,我从电子制造商那里得到了一些奇怪的错误日志。
我不知道如何解决它。我尝试了不同的方法。我希望这个社区能帮助我。提前致谢。
此配置适用于开发本地构建,并且在安装后也可以按预期正常工作。问题只会引发npm run package-deploy
命令。
我做错什么了吗?
包.json
{
"name": "analyzer",
"version": "1.2.1",
"private": true,
"homepage": "./",
"author": "Mohamed Jakkariya",
"description": "This application used for analyzing the stock information and find useful data for trading in the better way.",
"dependencies": {
"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "*",
"@reduxjs/toolkit": "^1.5.1",
"csv-parser": "^3.0.0",
"electron-is-dev": "^2.0.0",
"electron-updater": "^4.3.9",
"moment": "^2.29.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"styled-components": "^5.3.0"
},
"scripts": {
"start": "set BROWSER=none && react-scripts start",
"electron": "electron .",
"start-electron": "set ELECTRON_START_URL=http://localhost:3000 && electron .",
"test": "react-scripts test",
"eject": "react-scripts eject",
"build": "react-scripts build",
"build-electron": "robocopy src/electron build/electron /S ",
"lint": "eslint src/**/*.js src/**/*.jsx",
"package-build": "electron-builder build --win -c.extraMetadata.main=build/electron.js --publish never",
"package-deploy": "electron-builder build --win -c.extraMetadata.main=build/electron.js --publish always"
},
"main": "public/electron.js",
"publish": {
"provider": "github",
"repo": "nift-analyzer",
"owner": "MohamedJakkariya",
"releaseType": "release"
},
"repository": {
"type": "git",
"url": "https://github.com/MohamedJakkariya/nift-analyzer/"
},
"build": {
"productName": "Stock Analyzer",
"appId": "com.mohamedjakkariya.nift-analyzer",
"files": [
"build/**/*",
"node_modules/**/*"
],
"win": {
"icon": "./public/icon.png",
"publish": [
"github"
]
},
"directories": {
"buildResources": "assets"
}
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"electron": "^12.0.8",
"electron-builder": "^22.11.1",
"electron-devtools-installer": "^3.2.0",
"eslint-plugin-react": "^7.23.2"
}
}
错误日志
> analyzer@1.2.1 package-deploy
> electron-builder build --win -c.extraMetadata.main=build/electron.js --publish always
• electron-builder version=22.10.5 os=10.0.18362
• cannot check updates error=TypeError: update_notifier_1.default is not a function
• loaded configuration file=package.json ("build" field)
• loaded parent configuration preset=react-cra
• writing effective config file=dist\builder-effective-config.yaml
• packaging platform=win32 arch=x64 electron=12.0.8 appOutDir=dist\win-unpacked
• building target=nsis file=dist\Stock Analyzer Setup 1.2.1.exe archs=x64 oneClick=true perMachine=false
• building block map blockMapFile=dist\Stock Analyzer Setup 1.2.1.exe.blockmap
• publishing publisher=Github (owner: MohamedJakkariya, project: nift-analyzer, version: 1.2.1)
• uploading file=Stock-Analyzer-Setup-1.2.1.exe.blockmap provider=GitHub
• uploading file=Stock-Analyzer-Setup-1.2.1.exe provider=GitHub
⨯ Cannot cleanup:
Error #1 --------------------------------------------------------------------------------
TypeError: Cannot read property 'getType' of undefined
at GitHubPublisher.doUploadFile (C:\Users\MD\Desktop\stock-calc\node_modules\electron-publish\src\gitHubPublisher.ts:190:36)
at GitHubPublisher.doUpload (C:\Users\MD\Desktop\stock-calc\node_modules\electron-publish\src\gitHubPublisher.ts:170:23)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at GitHubPublisher.upload (C:\Users\MD\Desktop\stock-calc\node_modules\electron-publish\src\publisher.ts:87:5)
at async Promise.all (index 2)
at AsyncTaskManager.awaitTasks (C:\Users\MD\Desktop\stock-calc\node_modules\builder-util\src\asyncTaskManager.ts:65:25)
at PublishManager.awaitTasks (C:\Users\MD\Desktop\stock-calc\node_modules\app-builder-lib\src\publish\PublishManager.ts:228:5)
at Object.executeFinally (C:\Users\MD\Desktop\stock-calc\node_modules\builder-util\src\promise.ts:23:3)
Error #2 --------------------------------------------------------------------------------
TypeError: Cannot read property 'getType' of undefined
at GitHubPublisher.doUploadFile (C:\Users\MD\Desktop\stock-calc\node_modules\electron-publish\src\gitHubPublisher.ts:190:36)
at GitHubPublisher.doUpload (C:\Users\MD\Desktop\stock-calc\node_modules\electron-publish\src\gitHubPublisher.ts:170:23)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at GitHubPublisher.upload (C:\Users\MD\Desktop\stock-calc\node_modules\electron-publish\src\publisher.ts:87:5)
at async Promise.all (index 3)
at AsyncTaskManager.awaitTasks (C:\Users\MD\Desktop\stock-calc\node_modules\builder-util\src\asyncTaskManager.ts:65:25)
at PublishManager.awaitTasks (C:\Users\MD\Desktop\stock-calc\node_modules\app-builder-lib\src\publish\PublishManager.ts:228:5)
at Object.executeFinally (C:\Users\MD\Desktop\stock-calc\node_modules\builder-util\src\promise.ts:23:3) failedTask=build stackTrace=Error: Cannot cleanup