You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下npm安装dualshock包失败,报gyp构建错误求助

Fixing node-hid Installation Failures on Windows (dualshock Package Dependency)

Looks like you're hitting a classic pain point with native Node.js modules on Windows—node-hid (a core dependency of the dualshock package) relies on a properly configured C++ build toolchain to compile, and your current setup has a gap in that chain. Since you’ve already tried the basics like reinstalling node-gyp, clearing npm cache, and redoing Node.js, let’s dive into targeted fixes:

1. Switch to a Node.js LTS Version

Your current Node.js version is v13.2.0, an unstable odd-numbered release. Native modules like node-hid often have compatibility issues with non-LTS builds, as these versions prioritize new features over stability for native code support.

  • Uninstall Node.js v13.2.0 via Control Panel > Programs and Features
  • Download an LTS release (v12.x or v14.x are ideal for node-hid@0.5.7)
  • Reinstall, making sure to check the "Add Node.js to PATH" option during setup

2. Fix Visual Studio Build Tools Components

You have VS 2017 Build Tools installed, but it’s likely missing critical components required for compiling C++ native modules:

  • Open the Visual Studio Installer (search for it in the Start Menu)
  • Select "Modify" on your 2017 Build Tools installation
  • Under "Workloads", ensure Desktop development with C++ is checked
  • Expand the "Individual components" tab, find and check Windows 10 SDK (10.0.18363.x) (this matches your Windows 10 build 18363)
  • Click "Modify" to install the missing components, then restart your computer

3. Explicitly Set the MSBuild Path for node-gyp

Sometimes node-gyp can’t automatically locate the correct MSBuild executable. Let’s set it manually:

  • Open System Properties (right-click This PC → Properties → Advanced system settings)
  • Go to the Environment Variables section
  • Under "System variables", click "New":
    • Variable name: GYP_MSBUILD_PATH
    • Variable value: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe (matches the path in your error log)
  • Save the variable, then close and reopen your command prompt/PowerShell to apply changes

4. Run npm Install with Administrator Permissions

Permission restrictions can silently break the build process, especially when writing system-level build files:

  • Right-click Command Prompt or PowerShell and select Run as administrator
  • Navigate to your project directory
  • Run npm install dualshock again

5. Use Prebuilt Binaries or Upgrade node-hid

If compiling from source still fails, try skipping the build by using a prebuilt node-hid binary:

  • First install node-hid with prebuilt support: npm install node-hid@0.5.7 --build-from-source=false
  • Then run npm install dualshock

Alternatively, upgrade node-hid to a newer version with better Windows compatibility:
npm install node-hid@latest && npm install dualshock

Debugging Next Steps

If none of the above works, open the debug log mentioned in your error:
C:\Users\Starb\AppData\Roaming\npm-cache\_logs\2019-11-29T13_46_21_869Z-debug.log

Look for lines starting with MSBuild error—they’ll tell you exactly what’s missing (e.g., a specific header file or SDK component) to narrow down the fix further.


内容的提问来源于stack exchange,提问作者Starbuck 7410

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:47:13