【问题标题】:electron packager returns an error - command failed npm prune --production电子打包程序返回错误 - 命令失败 npm prune --production
【发布时间】:2019-11-12 07:13:03
【问题描述】:

我的电子打包器返回错误:

键入的命令:

electron-packager ./packager angular-test --platform=win32 --arch=ia32

错误:

Packaging app for platform win32 ia32 using electron v1.4.13
Command failed: npm prune --production
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "prune" "--production"
npm ERR! node v6.2.2
npm ERR! npm  v3.9.5
npm ERR! path C:\Users\dell\AppData\Local\Temp\electron-packager\win32-ia32\angular-test-win32-ia32\resources\app\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\dell\AppData\Local\Temp\electron-packager\win32-ia32\angular-test-win32-ia32\resources\app\package.json'
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\dell\AppData\Local\Temp\electron-packager\win32-ia32\angular-test-win32-ia32\resources\app\package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\dell\AppData\Local\Temp\electron-packager\win32-ia32\angular-test-win32-ia32\resources\app\npm-debug.log

有人知道出了什么问题吗?

【问题讨论】:

  • 它只发生在 angular2 电子应用程序中。其他电子应用程序运行良好,

标签: node.js electron


【解决方案1】:

您的./packager 目录中需要有一个package.json 文件。这是 Electron-packager 能够打包您的应用程序所需的文件。可以在here 找到示例 package.json 文件或快速参考:

{
  "name"    : "your-app",
  "version" : "0.1.0",
  "main"    : "main.js"
}

【讨论】:

    猜你喜欢
    • 2018-01-19
    • 2018-09-05
    • 2020-06-13
    • 2019-10-31
    • 2021-05-04
    • 2019-05-24
    • 2022-01-15
    • 2020-11-25
    • 2018-09-30
    相关资源
    最近更新 更多