【问题标题】:"Windows cannot access the specified..." .Exe's made by electron-packager nor electron-forge“Windows 无法访问指定的...” .Exe 由电子打包程序或电子伪造制作
【发布时间】:2020-04-17 19:35:02
【问题描述】:

我在 Win 8.1 x64 机器上。当我尝试运行生成的 Windows 二进制文件时,我收到一条 Windows 错误消息。

Windows 无法访问指定的设备、路径或文件。您可能没有适当的权限来访问该项目。

我尝试过的:

  • 我已检查权限,我的 UAC 帐户已拥有完全控制权。
  • 我从使用electron-forge make 切换到electron-packager [folder] [projectTitle] --platform=win32 --arch=x64(同样的错误)
  • 我更新了 npm、electron、electron-packager、electron-forge,有一次不得不在本地安装一系列包,并在 dep 和 devdep 之间处理一些事情
  • 特别是,为了满足electron-forge,我不得不将electron 依赖项移动到devdeps 部分
  • 将 .exe 复制到不同的文件夹,例如e:\ 并尝试从那里运行它(同样的错误)
  • 以管理员身份运行(同样的错误)
  • 将electronPackagerConfig.packageManager 更改为false,根据this recent known issue 的建议解决方法,关于修剪失败(与此问题无关,但它是一个因素)
  • 在 7zip 中打开两个 .exe 文件,发现electron-forge 生成的文件内容不多。这可能没什么,也可能与该命令的控制台输出相关,如下所示。

我的目标:

这是我的第一个电子应用程序(我来自网络背景)。在我开始将我的应用程序与 electron 的 API 显着集成之前,我正在做这个构建作为健全性检查。

命令输出

电子锻造

$ electron-forge make
We need to package your application before we can make it
[BABEL] Note: The code generator has deoptimised the styling of "E:/cygwin64/tmp/electron-packager/win32-x64/fictionDB-win32-x64/resources/app/.tmp/public/js/ckeditor/ckeditor.js" as it exceeds the max of "500KB".
[BABEL] Note: The code generator has deoptimised the styling of "E:/cygwin64/tmp/electron-packager/win32-x64/fictionDB-win32-x64/resources/app/.tmp/public/js/jquery-ui/jquery-ui.js" as it exceeds the max of "500KB".
Making for the following targets:

$

注意它似乎只是在那里切断了?我不知道,但我猜这很奇怪。

电子包装器。小说数据库 --platform=win32 --arch=x64

$ electron-packager . fictionDB --platform=win32 --arch=x64
Downloading tmp-50796-1-SHASUMS256.txt-7.1.7
[============================================>] 100.0% of 5.56 kB (5.56 kB/s)
Packaging app for platform win32 x64 using electron v7.1.7
Wrote new app to E:\xxx\Documents\src\js_src\Projects\testbed6\fictionDB-win32-x64

$

package.json

{
  "name": "fictionDB",
  "private": false,
  "version": "0.0.0",
  "description": "A way for fiction writers to plan & organize",
  "keywords": [
    "organize",
    "database",
    "fiction",
    "novel",
    "stories",
    "characters",
    "events",
    "locations",
    "settings"
  ],
  "dependencies": {
    "@sailshq/connect-redis": "^3.2.1",
    "@sailshq/lodash": "^3.10.3",
    "@sailshq/socket.io-redis": "^5.2.0",
    "acorn": "^7.1.0",
    "ckeditor": "^4.12.1",
    "connect-redis": "^4.0.3",
    "electron-compile": "^6.4.4",
    "electron-squirrel-startup": "^1.0.0",
    "grunt": "^1.0.4",
    "jquery": "^3.4.1",
    "jquery-ui-dist": "^1.12.1",
    "lodash": "^4.17.15",
    "request": "^2.88.0",
    "sails": "^1.2.3",
    "sails-hook-grunt": "^4.0.1",
    "sails-hook-orm": "^2.1.1",
    "sails-hook-sockets": "^2.0.0",
    "socket.io-redis": "^5.2.0"
  },
  "devDependencies": {
    "babel-plugin-transform-async-to-generator": "^6.24.1",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "electron": "^7.1.7",
    "electron-forge": "^5.2.4",
    "electron-prebuilt-compile": "4.0.0",
    "eslint": "5.16.0"
  },
  "scripts": {
    "start": "electron-forge start",
    "test": "npm run lint && npm run custom-tests && echo 'Done.'",
    "lint": "./node_modules/eslint/bin/eslint.js . --max-warnings=0 --report-unused-disable-directives && echo '✔  Your .js files look good.'",
    "custom-tests": "echo \"(No other custom tests yet.)\" && echo",
    "package": "electron-forge package",
    "make": "electron-forge make"
  },
  "main": "app/launch.js",
  "repository": {
    "type": "git",
    "url": "git://github.com/NathanHawks/FictionDB.git"
  },
  "author": "Nathan Hawks",
  "license": "MIT",
  "engines": {
    "node": "^8.9"
  },
  "config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      },
      "electronPackagerConfig": {
        "packageManager": false
      },
      "electronWinstallerConfig": {
        "name": "fictionDB"
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": "",
        "name": ""
      },
      "windowsStoreConfig": {
        "packageName": "",
        "name": "fictionDB"
      }
    }
  }
}

【问题讨论】:

    标签: node.js npm electron electron-packager electron-forge


    【解决方案1】:

    我忘记关闭防病毒防护罩。那解决了它。 (对于永久解决方案,我随后在防病毒应用程序的设置中添加了安全例外。)

    请注意,electron-forge 制作的版本不起作用:

    不过,electron-packager 一个人做的那个,效果很好。

    【讨论】:

      猜你喜欢
      • 2020-11-17
      • 2021-06-01
      • 2019-05-29
      • 2021-11-04
      • 2017-03-02
      • 2020-07-23
      • 1970-01-01
      • 2022-10-06
      • 2020-01-28
      相关资源
      最近更新 更多