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

Windows 10下构建Autodesk Forge RCDB遇node-gyp错误

Fixing npm install Failure for Forge Responsive Connected Database on Windows 10

Looking at your error log, the core issue is a malformed npm_config_node_gyp environment variable — notice the duplicate node prefix in the path: node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js. This causes Node.js to look for a non-existent module path, breaking the canvas@1.6.10 installation via node-gyp.

Here's a step-by-step fix tailored to your scenario:

1. Correct the npm_config_node_gyp Environment Variable

  • Open Command Prompt (CMD) as your regular user account (skip admin unless your npm was installed with admin rights)
  • Run this command to check your current setting:
    echo %npm_config_node_gyp%
    
  • If the output includes a leading node (like node C:\Users\me\...), fix it with this temporary command (replace with your actual node-gyp path):
    set npm_config_node_gyp=C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js
    
  • For a permanent fix: Go to System Properties > Advanced > Environment Variables, find npm_config_node_gyp in the user variables, and remove the extra node prefix from the path.

2. Clean and Reinstall Dependencies

  • Delete the node_modules folder and package-lock.json (or npm-shrinkwrap.json) from your project directory
  • Clear npm's cache to remove any corrupted files:
    npm cache clean --force
    
  • Re-run the installation command:
    npm install
    

3. Verify Node-gyp's Windows Prerequisites

Even if you've checked these before, double-critical dependencies that often cause node-gyp failures on Windows:

  • Install Python 2.7 (not Python 3.x) and ensure it's added to your system PATH
  • Install Visual Studio Build Tools (or Visual Studio 2015+) with the "Desktop development with C++" workload enabled
  • Reinstall global node-gyp to ensure it's up-to-date:
    npm install -g node-gyp
    

4. Fallback: Use Prebuilt Canvas Package

If the above steps still fail, replace the canvas dependency with a prebuilt version to bypass node-gyp entirely:

  • Open your project's package.json
  • Replace "canvas": "^1.6.10" with "canvas-prebuilt": "^1.6.10"
  • Repeat the clean/reinstall steps from section 2

Your Original Error Log

> canvas@1.6.10 install D:\DEVELOPMENT\Autodesk\forge-rcdb.nodejs3\node_modules\canvas
> node-gyp rebuild

D:\DEVELOPMENT\Autodesk\forge-rcdb.nodejs3\node_modules\canvas>if not defined npm_config_node_gyp (node "C:\Users\steck\AppData\Roaming\nvm\v7.7.1\node_modules\npm\bin\node-gyp-bin\\..\\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )

module.js:472
    throw err;
    ^

Error: Cannot find module 'D:\DEVELOPMENT\Autodesk\forge-rcdb.nodejs3\node_modules\canvas\node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:425:7)
    at startup (bootstrap_node.js:146:9)
    at bootstrap_node.js:540:3

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 06:50:17