请教各位大佬一下.我使用serialport模块.程序编译后正常运行.,但是无法打包,目前搞不清楚原因,特来请教!
PS C:\Users\appyjj\Desktop\cart> npm run build
> cart@1.0.0 build
> electron-builder --win --x64
• electron-builder version=22.14.13 os=10.0.19042
• loaded configuration file=package.json ("build" field)
• electron-rebuild not required if you use electron-builder, please consider to remove excess dependency from devDependencies
To ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`
• writing effective config file=dist\builder-effective-config.yaml
• rebuilding native dependencies dependencies=@serialport/bindings-cpp@10.7.0 platform=win32 arch=x64
• packaging platform=win32 arch=x64 electron=15.3.1 appOutDir=dist\win-unpacked
• rebuilding native dependencies dependencies=@serialport/bindings-cpp@10.7.0 platform=win32 arch=ia32
⨯ cannot execute cause=exit status 1
errorOut=npm ERR! code 1
npm ERR! path C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp-build
npm ERR! � ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ������ӡ�-m����� �
npm ERR! serialport.cpp
npm ERR! C:\Users\appyjj\.electron-gyp\15.3.1\include\node\v8.h(1684,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp\build\bindings.vcxproj]
npm ERR! C:\Users\appyjj\.electron-gyp\15.3.1\include\node\v8.h(8724,7): warning C4996: 'v8::HostImportModuleDynamicallyCallback': Use HostImportModuleDynamicallyWithImportAssertionsCallback instead [C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp\build\bindings.vcxproj]
npm ERR! serialport_win.cpp
npm ERR! C:\Users\appyjj\.electron-gyp\15.3.1\include\node\v8.h(1684,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp\build\bindings.vcxproj]
npm ERR! C:\Users\appyjj\.electron-gyp\15.3.1\include\node\v8.h(8724,7): warning C4996: 'v8::HostImportModuleDynamicallyCallback': Use HostImportModuleDynamicallyWithImportAssertionsCallback instead [C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp\build\bindings.vcxproj]
npm ERR! win_delay_load_hook.cc
npm ERR! C:\\Users\\appyjj\\.electron-gyp\\15.3.1\\ia32\\node.lib : fatal error LNK1106: �ļ���Ч���������: �����ҵ� 0x5D28E [C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp\build\bindings.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.0
npm ERR! gyp info using node@18.2.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.7 found at "C:\Users\appyjj\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp info find VS using VS2022 (17.3.32922.545) found at:
npm ERR! gyp info find VS "E:\Microsoft Visual Studio\2022\Professional"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Users\appyjj\AppData\Local\Programs\Python\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\@serialport\\bindings-cpp\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\appyjj\\.electron-gyp\\15.3.1\\include\\node\\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\\Users\\appyjj\\.electron-gyp\\15.3.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\appyjj\\\\.electron-gyp\\\\15.3.1\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\@serialport\\bindings-cpp',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\@serialport\\bindings-cpp\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn E:\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=Win32'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `E:\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Users\appyjj\Desktop\cart\node_modules\node-gyp\lib\build.js:203:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp
npm ERR! gyp ERR! node -v v18.2.0
npm ERR! gyp ERR! node-gyp -v v9.3.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\appyjj\AppData\Local\npm-cache\_logs\2022-10-12T23_11_25_924Z-debug-0.log
command='C:\Program Files\nodejs\node.exe' 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' rebuild @serialport/bindings-cpp@10.7.0
workingDir=
以下是日志
0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
1 info using npm@8.9.0
2 info using node@v18.2.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\Users\appyjj\Desktop\cart\.npmrc Completed in 1ms
10 timing config:load:project Completed in 7ms
11 timing config:load:file:C:\Users\appyjj\.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:C:\Users\appyjj\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 2ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 21ms
19 timing npm:load:configload Completed in 22ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm rebuild @serialport/bindings-cpp@10.7.0
23 verbose argv "rebuild" "@serialport/bindings-cpp@10.7.0"
24 timing npm:load:setTitle Completed in 1ms
25 timing config:load:flatten Completed in 4ms
26 timing npm:load:display Completed in 5ms
27 verbose logfile logs-max:10 dir:C:\Users\appyjj\AppData\Local\npm-cache\_logs
28 verbose logfile C:\Users\appyjj\AppData\Local\npm-cache\_logs\2022-10-12T23_11_25_924Z-debug-0.log
29 timing npm:load:logFile Completed in 15ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 44ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile start cleaning logs, removing 1 files
35 silly logfile done cleaning log files
36 verbose shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules/@serialport/bindings-cpp
37 timing build:queue Completed in 1ms
38 info run @serialport/bindings-cpp@10.7.0 install node_modules/@serialport/bindings-cpp node-gyp-build
39 info run @serialport/bindings-cpp@10.7.0 install { code: 1, signal: null }
40 timing command:rebuild Completed in 8436ms
41 verbose stack Error: command failed
41 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:63:27)
41 verbose stack at ChildProcess.emit (node:events:527:28)
41 verbose stack at maybeClose (node:internal/child_process:1090:16)
41 verbose stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
42 verbose pkgid @serialport/bindings-cpp@10.7.0
43 verbose cwd C:\Users\appyjj\Desktop\cart
44 verbose Windows_NT 10.0.19042
45 verbose node v18.2.0
46 verbose npm v8.9.0
47 error code 1
48 error path C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp
49 error command failed
50 error command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp-build
51 error � ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ������ӡ�-m����� �
51 error serialport.cpp
51 error C:\Users\appyjj\.electron-gyp\15.3.1\include\node\v8.h(1684,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp\build\bindings.vcxproj]
51 error C:\Users\appyjj\.electron-gyp\15.3.1\include\node\v8.h(8724,7): warning C4996: 'v8::HostImportModuleDynamicallyCallback': Use HostImportModuleDynamicallyWithImportAssertionsCallback instead [C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp\build\bindings.vcxproj]
51 error serialport_win.cpp
51 error C:\Users\appyjj\.electron-gyp\15.3.1\include\node\v8.h(1684,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp\build\bindings.vcxproj]
51 error C:\Users\appyjj\.electron-gyp\15.3.1\include\node\v8.h(8724,7): warning C4996: 'v8::HostImportModuleDynamicallyCallback': Use HostImportModuleDynamicallyWithImportAssertionsCallback instead [C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp\build\bindings.vcxproj]
51 error win_delay_load_hook.cc
51 error C:\\Users\\appyjj\\.electron-gyp\\15.3.1\\ia32\\node.lib : fatal error LNK1106: �ļ���Ч���������: �����ҵ� 0x5D28E [C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp\build\bindings.vcxproj]
52 error gyp info it worked if it ends with ok
52 error gyp info using node-gyp@9.3.0
52 error gyp info using node@18.2.0 | win32 | x64
52 error gyp info find Python using Python version 3.10.7 found at "C:\Users\appyjj\AppData\Local\Programs\Python\Python310\python.exe"
52 error gyp info find VS using VS2022 (17.3.32922.545) found at:
52 error gyp info find VS "E:\Microsoft Visual Studio\2022\Professional"
52 error gyp info find VS run with --verbose for detailed information
52 error gyp info spawn C:\Users\appyjj\AppData\Local\Programs\Python\Python310\python.exe
52 error gyp info spawn args [
52 error gyp info spawn args 'C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\node-gyp\\gyp\\gyp_main.py',
52 error gyp info spawn args 'binding.gyp',
52 error gyp info spawn args '-f',
52 error gyp info spawn args 'msvs',
52 error gyp info spawn args '-I',
52 error gyp info spawn args 'C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\@serialport\\bindings-cpp\\build\\config.gypi',
52 error gyp info spawn args '-I',
52 error gyp info spawn args 'C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\node-gyp\\addon.gypi',
52 error gyp info spawn args '-I',
52 error gyp info spawn args 'C:\\Users\\appyjj\\.electron-gyp\\15.3.1\\include\\node\\common.gypi',
52 error gyp info spawn args '-Dlibrary=shared_library',
52 error gyp info spawn args '-Dvisibility=default',
52 error gyp info spawn args '-Dnode_root_dir=C:\\Users\\appyjj\\.electron-gyp\\15.3.1',
52 error gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\node-gyp',
52 error gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\appyjj\\\\.electron-gyp\\\\15.3.1\\\\<(target_arch)\\\\node.lib',
52 error gyp info spawn args '-Dmodule_root_dir=C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\@serialport\\bindings-cpp',
52 error gyp info spawn args '-Dnode_engine=v8',
52 error gyp info spawn args '--depth=.',
52 error gyp info spawn args '--no-parallel',
52 error gyp info spawn args '--generator-output',
52 error gyp info spawn args 'C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\@serialport\\bindings-cpp\\build',
52 error gyp info spawn args '-Goutput_dir=.'
52 error gyp info spawn args ]
52 error gyp info spawn E:\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe
52 error gyp info spawn args [
52 error gyp info spawn args 'build/binding.sln',
52 error gyp info spawn args '/clp:Verbosity=minimal',
52 error gyp info spawn args '/nologo',
52 error gyp info spawn args '/p:Configuration=Release;Platform=Win32'
52 error gyp info spawn args ]
52 error gyp ERR! build error
52 error gyp ERR! stack Error: `E:\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
52 error gyp ERR! stack at ChildProcess.onExit (C:\Users\appyjj\Desktop\cart\node_modules\node-gyp\lib\build.js:203:23)
52 error gyp ERR! stack at ChildProcess.emit (node:events:527:28)
52 error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
52 error gyp ERR! System Windows_NT 10.0.19042
52 error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\appyjj\\Desktop\\cart\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
52 error gyp ERR! cwd C:\Users\appyjj\Desktop\cart\node_modules\@serialport\bindings-cpp
52 error gyp ERR! node -v v18.2.0
52 error gyp ERR! node-gyp -v v9.3.0
52 error gyp ERR! not ok
53 verbose exit 1
54 timing npm Completed in 8816ms
55 verbose unfinished npm timer build 1665616286717
56 verbose unfinished npm timer build:deps 1665616286717
57 verbose unfinished npm timer build:run:install 1665616286718
58 verbose unfinished npm timer build:run:install:node_modules/@serialport/bindings-cpp 1665616286718
59 verbose code 1
60 error A complete log of this run can be found in:
60 error C:\Users\appyjj\AppData\Local\npm-cache\_logs\2022-10-12T23_11_25_924Z-debug-0.log
项目很着急.麻烦看到的大佬帮忙出出主意!谢谢了!