Electron error after running node-gyp rebuild


#1

Hello,

I am trying to build the node-usb module in electron, but vainly (I went through this : Use node-usb inside electron)

When I run this command :

node-gyp rebuild --target=1.4.5 --arch=x64 --dist-url=https://atom.io/download/electron --msvs_version=2015

I get the following error :

C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb>node-gyp
 rebuild --target=1.4.5 --arch=x64 --dist-url=https://atom.io/download/electron
--msvs_version=2015
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@6.9.1 | win32 | x64
gyp info spawn C:\Program Files\Python\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\TONPC\\AppData\\Roaming\\npm\\node_modules\\no
de-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=2015',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\TONPC\\Documents\\electron\\electron-quick-sta
rt\\node_modules\\usb\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\TONPC\\AppData\\Roaming\\npm\\node_modules\\no
de-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\TONPC\\.node-gyp\\iojs-1.4.5\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\TONPC\\.node-gyp\\iojs-1.4.5',

gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\TONPC\\AppData\\Roaming\\npm\\n
ode_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\TONPC\\Documents\\electron\\
electron-quick-start\\node_modules\\usb',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\TONPC\\Documents\\electron\\electron-quick-sta
rt\\node_modules\\usb\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Génération des projets individuellement dans cette solution. Pour activer la gén
ération en parallèle, ajoutez le commutateur "/m".
  core.c
  descriptor.c
  hotplug.c
  io.c
C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb\libusb\
libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefin
ition (compiling source file ..\libusb\libusb\descriptor.c) [C:\Users\TONPC\Doc
uments\electron\electron-quick-start\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39):
  note: see declaration of 'timespec' (compiling source file ..\libusb\libusb\d
  escriptor.c)
  strerror.c
C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb\libusb\
libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefin
ition (compiling source file ..\libusb\libusb\core.c) [C:\Users\TONPC\Documents
\electron\electron-quick-start\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39):
  note: see declaration of 'timespec' (compiling source file ..\libusb\libusb\c
  ore.c)
  sync.c
C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb\libusb\
libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefin
ition (compiling source file ..\libusb\libusb\hotplug.c) [C:\Users\TONPC\Docume
nts\electron\electron-quick-start\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39):
  note: see declaration of 'timespec' (compiling source file ..\libusb\libusb\h
  otplug.c)
  poll_windows.c
C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb\libusb\
libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefin
ition (compiling source file ..\libusb\libusb\io.c) [C:\Users\TONPC\Documents\e
lectron\electron-quick-start\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39):
  note: see declaration of 'timespec' (compiling source file ..\libusb\libusb\i
  o.c)
..\libusb\libusb\io.c(1227): warning C4244: '=': conversion from 'time_t' to 'l
ong', possible loss of data [C:\Users\TONPC\Documents\electron\electron-quick-s
tart\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\io.c(1902): warning C4244: '=': conversion from 'time_t' to 'l
ong', possible loss of data [C:\Users\TONPC\Documents\electron\electron-quick-s
tart\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\io.c(2435): warning C4244: '=': conversion from 'time_t' to 'l
ong', possible loss of data [C:\Users\TONPC\Documents\electron\electron-quick-s
tart\node_modules\usb\build\libusb.vcxproj]
  threads_windows.c
C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb\libusb\
libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefin
ition (compiling source file ..\libusb\libusb\strerror.c) [C:\Users\TONPC\Docum
ents\electron\electron-quick-start\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39):
  note: see declaration of 'timespec' (compiling source file ..\libusb\libusb\s
  trerror.c)
C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb\libusb\
libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefin
ition (compiling source file ..\libusb\libusb\sync.c) [C:\Users\TONPC\Documents
\electron\electron-quick-start\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39):
  note: see declaration of 'timespec' (compiling source file ..\libusb\libusb\s
  ync.c)
  windows_usb.c
C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb\libusb\
libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefin
ition (compiling source file ..\libusb\libusb\os\poll_windows.c) [C:\Users\TONP
C\Documents\electron\electron-quick-start\node_modules\usb\build\libusb.vcxproj
]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39):
  note: see declaration of 'timespec' (compiling source file ..\libusb\libusb\o
  s\poll_windows.c)
C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb\libusb\
libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefin
ition (compiling source file ..\libusb\libusb\os\threads_windows.c) [C:\Users\T
ONPC\Documents\electron\electron-quick-start\node_modules\usb\build\libusb.vcxp
roj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39):
  note: see declaration of 'timespec' (compiling source file ..\libusb\libusb\o
  s\threads_windows.c)
..\libusb\libusb\os\threads_windows.c(194): warning C4244: '=': conversion from
 'time_t' to 'long', possible loss of data [C:\Users\TONPC\Documents\electron\e
lectron-quick-start\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\os\threads_windows.c(196): warning C4244: '=': conversion from
 'const time_t' to 'long', possible loss of data [C:\Users\TONPC\Documents\elec
tron\electron-quick-start\node_modules\usb\build\libusb.vcxproj]
C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb\libusb\
libusb\os/threads_windows.h(47): error C2011: 'timespec': 'struct' type redefin
ition (compiling source file ..\libusb\libusb\os\windows_usb.c) [C:\Users\TONPC
\Documents\electron\electron-quick-start\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39):
  note: see declaration of 'timespec' (compiling source file ..\libusb\libusb\o
  s\windows_usb.c)
..\libusb\libusb\os\windows_usb.c(586): warning C4244: '=': conversion from '__
int64' to 'unsigned int', possible loss of data [C:\Users\TONPC\Documents\elect
ron\electron-quick-start\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\os\windows_usb.c(1017): warning C4996: 'GetVersionExA': was de
clared deprecated [C:\Users\TONPC\Documents\electron\electron-quick-start\node_
modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433): note: s
  ee declaration of 'GetVersionExA'
..\libusb\libusb\os\windows_usb.c(1020): warning C4996: 'GetVersionExA': was de
clared deprecated [C:\Users\TONPC\Documents\electron\electron-quick-start\node_
modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433): note: s
  ee declaration of 'GetVersionExA'
..\libusb\libusb\os\windows_usb.c(1423): warning C4244: '=': conversion from '_
_int64' to 'unsigned int', possible loss of data [C:\Users\TONPC\Documents\elec
tron\electron-quick-start\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\os\windows_usb.c(2558): warning C4018: '<': signed/unsigned mi
smatch [C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb
\build\libusb.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\TONPC\AppData\Roaming\npm\no
de_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:215:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\TONPC\\AppDat
a\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1
.4.5" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--msvs_versio
n=2015"
gyp ERR! cwd C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules
\usb
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

C:\Users\TONPC\Documents\electron\electron-quick-start\node_modules\usb>

Could you ple