question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to rebuild node-usb for Electron on Windows 10

See original GitHub issue

I’m trying to rebuild node-usb for my Electron application on Windows 10. I install node-usb, node-gyp and tried the following command:

E:\Masterthesis\Simplex-Electron\node_modules\usb>node-gyp rebuild --target=1.4.14 --dist-url=https://atom.io/download/atom-shell

Unfortunately I get the following output with an error at the end:

gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@4.4.5 | win32 | x64
gyp http GET https://atom.io/download/atom-shell/v1.4.14/iojs-v1.4.14.tar.gz
gyp http 200 https://atom.io/download/atom-shell/v1.4.14/iojs-v1.4.14.tar.gz
gyp http GET https://atom.io/download/atom-shell/v1.4.14/SHASUMS256.txt
gyp http GET https://atom.io/download/atom-shell/v1.4.14/win-x64/iojs.lib
gyp http GET https://atom.io/download/atom-shell/v1.4.14/win-x86/iojs.lib
gyp http 200 https://atom.io/download/atom-shell/v1.4.14/win-x86/iojs.lib
gyp http 200 https://atom.io/download/atom-shell/v1.4.14/SHASUMS256.txt
gyp http 200 https://atom.io/download/atom-shell/v1.4.14/win-x64/iojs.lib
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\Users\\Fabia\\AppData\\Roaming\\npm\\node_modules\\node-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=auto',
gyp info spawn args   '-I',
gyp info spawn args   'E:\\Masterthesis\\Simplex-Electron\\node_modules\\usb\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Fabia\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Fabia\\.node-gyp\\iojs-1.4.14\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Fabia\\.node-gyp\\iojs-1.4.14',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Fabia\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=E:\\Masterthesis\\Simplex-Electron\\node_modules\\usb',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'E:\\Masterthesis\\Simplex-Electron\\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' ]
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu ermöglichen, müssen Sie den Schalter "/m" hinzufügen.
  core.c
  descriptor.c
  hotplug.c
  io.c
  strerror.c
  sync.c
  poll_windows.c
  threads_windows.c
E:\Masterthesis\Simplex-Electron\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: "timespec": "struct" Typneudefinition (Quelldatei wird kompiliert ..\libusb\libusb\sync.c) [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxpr
oj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: Siehe Deklaration von "timespec" (Quelldatei wird kompiliert ..\libusb\libusb\sync.c)
  windows_usb.c
E:\Masterthesis\Simplex-Electron\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: "timespec": "struct" Typneudefinition (Quelldatei wird kompiliert ..\libusb\libusb\io.c) [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxproj
]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: Siehe Deklaration von "timespec" (Quelldatei wird kompiliert ..\libusb\libusb\io.c)
E:\Masterthesis\Simplex-Electron\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: "timespec": "struct" Typneudefinition (Quelldatei wird kompiliert ..\libusb\libusb\hotplug.c) [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vc
xproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: Siehe Deklaration von "timespec" (Quelldatei wird kompiliert ..\libusb\libusb\hotplug.c)..\libusb\libusb\io.c(1227): warning C4244: "=": Konvertierung von "time_t" in "long", mög
  licher Datenverlust

..\libusb\libusb\io.c(1902): warning C4244: "=": Konvertierung von "time_t" in "long", möglicher Datenverlust [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxproj]
E:\Masterthesis\Simplex-Electron\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: "timespec": "struct" Typneudefinition (Quelldatei wird kompiliert ..\libusb\libusb\os\threads_windows.c)..\libusb\libusb\io.c(2435): warning C4244: "=": Konvert
ierung von "time_t" in "long", möglicher Datenverlust [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxproj]

  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: Siehe Deklaration von "timespec" (Quelldatei wird kompiliert ..\libusb\libusb\os\threads_windows.c)
E:\Masterthesis\Simplex-Electron\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: "timespec": "struct" Typneudefinition (Quelldatei wird kompiliert ..\libusb\libusb\core.c)..\libusb\libusb\os\threads_windows.c(194): warning C4244: "=": Konver
tierung von "time_t" in "long", möglicher Datenverlust [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: Siehe Deklaration von "timespec" (Quelldatei wird kompiliert ..\libusb\libusb\core.c)

E:\Masterthesis\Simplex-Electron\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: "timespec": "struct" Typneudefinition (Quelldatei wird kompiliert ..\libusb\libusb\descriptor.c) [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb
.vcxproj]
..\libusb\libusb\os\threads_windows.c(196): warning C4244: "=": Konvertierung von "const time_t" in "long", möglicher DatenverlustC:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: Siehe Deklaration von "timespec" (Quelldatei wird 
kompiliert ..\libusb\libusb\descriptor.c) [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxproj]

E:\Masterthesis\Simplex-Electron\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: "timespec": "struct" Typneudefinition (Quelldatei wird kompiliert ..\libusb\libusb\strerror.c) [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.v
cxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: Siehe Deklaration von "timespec" (Quelldatei wird kompiliert ..\libusb\libusb\strerror.c)
E:\Masterthesis\Simplex-Electron\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: "timespec": "struct" Typneudefinition (Quelldatei wird kompiliert ..\libusb\libusb\os\poll_windows.c) [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\l
ibusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: Siehe Deklaration von "timespec" (Quelldatei wird kompiliert ..\libusb\libusb\os\poll_windows.c)
E:\Masterthesis\Simplex-Electron\node_modules\usb\libusb\libusb\os/threads_windows.h(47): error C2011: "timespec": "struct" Typneudefinition (Quelldatei wird kompiliert ..\libusb\libusb\os\windows_usb.c) [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\li
busb.vcxproj]
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: Siehe Deklaration von "timespec" (Quelldatei wird kompiliert ..\libusb\libusb\os\windows_usb.c)
..\libusb\libusb\os\windows_usb.c(586): warning C4244: "=": Konvertierung von "__int64" in "unsigned int", möglicher Datenverlust [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\os\windows_usb.c(1017): warning C4996: 'GetVersionExA': wurde als veraltet deklariert [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433): note: Siehe Deklaration von "GetVersionExA"
..\libusb\libusb\os\windows_usb.c(1020): warning C4996: 'GetVersionExA': wurde als veraltet deklariert [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433): note: Siehe Deklaration von "GetVersionExA"
..\libusb\libusb\os\windows_usb.c(1423): warning C4244: "=": Konvertierung von "__int64" in "unsigned int", möglicher Datenverlust [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxproj]
..\libusb\libusb\os\windows_usb.c(2558): warning C4018: "<": Konflikt zwischen "signed" und "unsigned" [E:\Masterthesis\Simplex-Electron\node_modules\usb\build\libusb.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Fabia\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Fabia\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.4.14" "--dist-url=https://atom.io/download/atom-shell"
gyp ERR! cwd E:\Masterthesis\Simplex-Electron\node_modules\usb
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

Maybe someone had this problem already because I’ve no clue what I could fix.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bglasecommented, Oct 17, 2017

What is the timeframe for publishing this to NPM?

1reaction
saboyacommented, Jun 24, 2017

Version 1.3.0 was tagged recently, you can change your package.json to use that:

...
    "usb": "git+https://github.com/tessel/node-usb.git#1.3.0",
...
Read more comments on GitHub >

github_iconTop Results From Across the Web

Trying to rebuild node-usb for Electron on Windows 10 #162
I'm trying to rebuild node-usb for my Electron application on Windows 10. I install node-usb, node-gyp and tried the following command:.
Read more >
Installing node_usb_detection for Electron in Windows 10
I've npm installed node_usb_detection and successfully rebuilt the native node_usb module that it depends on. The following line (5) in the usb.
Read more >
usb-detection - npm
Start using usb-detection in your project by running `npm i usb-detection`. ... and can be installed automatically using electron-rebuild.
Read more >
Node USB
Documentation for Node USB.
Read more >
Native Node Modules | Electron
When in doubt, run electron-rebuild first. Make sure the native module is compatible with the target platform and architecture for your Electron app....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found