简体   繁体   English

“Windows 无法访问指定的...”.exe 是由电子包装商或电子锻造制作的

[英]"Windows cannot access the specified..." .Exe's made by electron-packager nor electron-forge

I'm on a Win 8.1 x64 machine.我在 Win 8.1 x64 机器上。 When I try to run the generated Windows binaries, I get a Windows error message.当我尝试运行生成的 Windows 二进制文件时,我收到一条 Windows 错误消息。

Windows cannot access the specified device, path, or file. Windows 无法访问指定的设备、路径或文件。 You may not have the appropriate permissions to access the item.您可能没有访问该项目的适当权限。

What I've tried:我试过的:

  • I've checked permissions, my UAC account already had full control.我检查了权限,我的 UAC 帐户已经完全控制了。
  • I switched from using electron-forge make to electron-packager [folder] [projectTitle] --platform=win32 --arch=x64 (same error)我从使用electron-forge make electron-packager [folder] [projectTitle] --platform=win32 --arch=x64 electron-forge make切换到electron-packager [folder] [projectTitle] --platform=win32 --arch=x64 (同样的错误)
  • I updated npm, electron, electron-packager, electron-forge, and at one point had to install locally a series of packages and juggle some things from dep to devdep我更新了 npm、electron、electron-packager、electron-forge,有一次不得不在本地安装一系列包,并在 dep 到 devdep 之间处理一些事情
  • In particular, I had to move electron dependency to the devdeps section in order to satisfy electron-forge特别是,我不得不将electron依赖移到 devdeps 部分以满足electron-forge
  • Copied the .exe to a different folder eg e:\\ and tried running it from there (same error)将 .exe 复制到不同的文件夹,例如 e:\\ 并尝试从那里运行它(相同的错误)
  • Running as Administrator (same error)以管理员身份运行(同样的错误)
  • Changed electronPackagerConfig.packageManager to false per the recommended workaround for this recent known issue about pruning failing (not related to this problem, but it's a factor in play)根据最近关于修剪失败的已知问题的推荐解决方法,将electronPackagerConfig.packageManager更改为false (与此问题无关,但这是一个因素)
  • Opened both .exe's in 7zip and noticed that the one generated by electron-forge didn't have much in it.在 7zip 中打开两个 .exe 并注意到electron-forge生成的那个没有太多内容。 This may be nothing or it may correlate with the console output for that command, below.这可能没什么,也可能与下面该命令的控制台输出相关。

My Goal:我的目标:

This is my first electron app (I come from a web background).这是我的第一个电子应用程序(我来自网络背景)。 I'm doing this build as a sanity check before I start significantly integrating my app with electron's API.在我开始将我的应用程序与电子 API 显着集成之前,我正在做这个构建作为健全性检查。

Output of commands命令的输出

electron-forge make电子锻造制造

$ 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:

$

Notice how it seems to just cut off there?请注意它似乎只是在那里切断了? I wouldn't know but I'm guessing that's odd.我不知道,但我猜这很奇怪。

electron-packager .电子封装器。 fictionDB --platform=win32 --arch=x64小说数据库 --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包.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"
      }
    }
  }
}

I forgot to turn off antivirus shields.我忘了关闭防病毒防护罩。 That fixed it.那修复了它。 (For the permanent solution, I then added a security exception in my antivirus app's settings.) (对于永久解决方案,我然后在我的防病毒应用程序的设置中添加了一个安全例外。)

As a note of interest, the version made by electron-forge didn't work:有趣的是,electron-forge 制作的版本不起作用:

javascript 错误的屏幕截图:“要求 c:\\yadda\\app.js 但它没有预编译!

However, the one made by electron-packager alone, worked fine.然而,由electron-packager单独制作的,效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM