电子打包器返回错误 - 命令失败npm prune --production

时间:2016-12-31 19:39:10

标签: node.js electron

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

这是我的命令

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

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

1 个答案:

答案 0 :(得分:2)

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

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