我正在尝试使用电子修建器在Electron中构建一个设置文件 但它总是给我一个错误。我在电子,npm和nodejs上运行最新版本。
{
"name": "whatsapp",
"version": "1.0.0",
"description": "WhatsApp software",
"main": "main.js",
"scripts": {
"start": "electron .",
"pack": "build --dir",
"dist": "build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/TheNerdGuyLulu/WhatsApp.git"
},
"keywords": [
"whatsapp"
],
"author": "TheNerdGuyLulu",
"license": "MIT",
"devDependencies": {
"electron": "^1.6.5",
"electron-builder": "^17.0.3",
"electron-packager": "^8.6.0"
}
}
这是错误:
D:\Programação\Projetos\ELECTRON\WhatsApp>npm run dist
> whatsapp@1.0.0 dist D:\Programação\Projetos\ELECTRON\WhatsApp
> build
No native production dependencies
Packaging for win32 x64 using electron 1.6.5 to dist\win-unpacked
⚠️ Application icon is not set, default Electron icon will be used
Building NSIS installer
Packaging NSIS installer for arch x64
Error: C:\Users\Luís Chaves\AppData\Local\electron-builder\cache\nsis\nsis-3.0.1.10\Bin\makensis.exe exited with code 1
Output:
Command line defined: "APP_ID=com.electron.whatsapp"
Command line defined: "APP_GUID=aee039cb-0158-543a-a7b5-acca8f2097e8"
Command line defined: "PRODUCT_NAME=whatsapp"
Command line defined: "PRODUCT_FILENAME=whatsapp"
Command line defined: "APP_FILENAME=whatsapp"
Command line defined: "APP_DESCRIPTION=WhatsApp software"
Command line defined: "VERSION=1.0.0"
Command line defined: "COMPANY_NAME=TheNerdGuyLulu"
Command line defined: "PROJECT_DIR=D:\Programa��o\Projetos\ELECTRON\WhatsApp"
Command line defined: "BUILD_RESOURCES_DIR=D:\Programa��o\Projetos\ELECTRON\WhatsApp\build"
Command line defined: "APP_64=D:\Programa��o\Projetos\ELECTRON\WhatsApp\dist\whatsapp-1.0.0-x64.nsis.7z"
Command line defined: "APP_64_NAME=whatsapp-1.0.0-x64.nsis.7z"
Command line defined: "COMPRESSION_METHOD=7z"
Command line defined: "ONE_CLICK"
Command line defined: "RUN_AFTER_FINISH"
Command line defined: "MULTI_LANGUAGE_INSTALLER"
Command line defined: "COMPRESS=auto"
Command line defined: "BUILD_UNINSTALLER"
Command line defined: "UNINSTALLER_OUT_FILE=C:\Users\LUSCHA~1\AppData\Local\Temp\electron-builder-kztCbb\0-1-uninstaller.exe"
Processing config: C:\Users\Lu�s Chaves\AppData\Local\electron-builder\cache\nsis\nsis-3.0.1.10\nsisconf.nsh
Processing script file: "<stdin>" (ACP)
Error output:
!include: could not find: "UAC.nsh"
!include: error in script: "multiUser.nsh" on line 2
Error in script "<stdin>" on line 10 -- aborting creation process
NSIS script:
!addincludedir "D:\Programação\Projetos\ELECTRON\WhatsApp\node_modules\electron-builder\templates\nsis\include"
!addplugindir /x86-unicode "C:\Users\Luís Chaves\AppData\Local\electron-builder\cache\nsis-resources\nsis-resources-3.0.0\plugins\x86-unicode"
!addplugindir /x86-unicode "D:\Programação\Projetos\ELECTRON\WhatsApp\build\x86-unicode"
!include "C:\Users\LUSCHA~1\AppData\Local\Temp\electron-builder-kztCbb\0-2-messages.nsh"
Var startMenuLink
Var desktopLink
!include "common.nsh"
!include "MUI2.nsh"
!include "multiUser.nsh"
!include "allowOnlyOneInstallerInstance.nsh"
!ifdef INSTALL_MODE_PER_ALL_USERS
!ifdef BUILD_UNINSTALLER
RequestExecutionLevel user
!else
RequestExecutionLevel admin
!endif
!else
RequestExecutionLevel user
!endif
!ifdef ONE_CLICK
!include "oneClick.nsh"
!else
!include "boringInstaller.nsh"
!endif
!ifmacrodef customHeader
!insertmacro customHeader
!endif
!ifdef BUILD_UNINSTALLER
SilentInstall silent
!else
Var appExe
!endif
Function .onInit
!ifmacrodef preInit
!insertmacro preInit
!endif
!ifdef BUILD_UNINSTALLER
WriteUninstaller "${UNINSTALLER_OUT_FILE}"
!insertmacro quitSuccess
!else
!insertmacro check64BitAndSetRegView
!ifdef ONE_CLICK
!insertmacro ALLOW_ONLY_ONE_INSTALLER_INSTANCE
!else
${IfNot} ${UAC_IsInnerInstance}
!insertmacro ALLOW_ONLY_ONE_INSTALLER_INSTANCE
${EndIf}
!endif
!insertmacro initMultiUser
!ifmacrodef customInit
!insertmacro customInit
!endif
!endif
FunctionEnd
!ifndef BUILD_UNINSTALLER
!include "installUtil.nsh"
!endif
Section "install"
!ifndef BUILD_UNINSTALLER
!include "installSection.nsh"
!endif
SectionEnd
!ifdef BUILD_UNINSTALLER
!include "uninstaller.nsh"
!endif
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "D:\\Programas\\nodejs\\node.exe" "D:\\Programas\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dist"npm ERR! node v7.9.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! whatsapp@1.0.0 dist: `build`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the whatsapp@1.0.0 dist script 'build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the whatsapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs whatsapp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls whatsapp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Luís Chaves\AppData\Roaming\npm-cache\_logs\2017-04-24T00_01_13_272Z-debug.log
我为这个问题疯狂,请帮助我
答案 0 :(得分:0)
您是否可以尝试在package.json文件中添加以下构建属性条目,如下所示:
{
"build": {
"extraFiles": [
"some-internal-plugin-dist"
],
"appId": "myCompany.myApp",
"nsis": {
"perMachine": true,
"oneClick": false,
"allowToChangeInstallationDirectory": true
},
"squirrelWindows": {},
"files": [
"electron.js",
"www/**/*"
],
"directories": {
"buildResources": "www/build"
},
"appx": {
"identityName": "myCompany.myApp",
"publisher": "CN=number",
"publisherDisplayName": "my publisher name",
"applicationId": "myApp",
"displayName": "myApp"
},
"win": {
"certificateFile": "./certs/CordovaApp.wincert.pfx",
"icon": "www/build/win.ico",
"publisherName": "my Company",
"target": [
{
"target": "nsis",
"arch": [
"ia32"
]
}
]
},
"nodeGypRebuild": "false",
"npmRebuild": "false"
}
}
它需要在package.json文件中具有构建配置。