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

执行gatsby new命令报错:TypeError: rd.cursorTo is not a function

解决Windows 11下Node.js v18.7.0执行gatsby new报错问题

问题描述

在Windows 11系统使用Node.js v18.7.0执行gatsby new命令创建站点时,出现以下报错:

Cloning site template C:\Users\catal\AppData\Roaming\npm\node_modules\gatsby-cli\node_modules\yoga-layout-prebuilt\yoga-layout\build\Release\nbind.js:53
        throw ex;
        ^

TypeError: rd.cursorTo is not a function
    at Timeout._onTimeout (C:\Users\catal\AppData\Roaming\npm\node_modules\gatsby-cli\node_modules\create-gatsby\lib\index.js:5:852)
    at listOnTimeout (node:internal/timers:564:17)
    at processTimers (node:internal/timers:507:7)

报错原因

该错误源于gatsby-cli依赖的create-gatsby库使用了rd.cursorTo方法,但Node.js v18对相关模块的API进行了调整,导致该方法不存在,触发类型错误。

解决方案

  • 降级Node.js版本:切换到Node.js v16.x系列(该版本与当前gatsby-cli依赖兼容)。推荐使用nvm管理版本,执行以下命令:
    nvm install 16
    nvm use 16
    
  • 升级gatsby-cli到最新版:新版CLI大概率修复了Node.js v18的兼容问题,执行命令:
    npm install -g gatsby-cli@latest
    
  • 手动克隆模板创建站点:如果以上方法无效,直接克隆官方默认模板:
    git clone https://github.com/gatsbyjs/gatsby-starter-default.git my-gatsby-site
    cd my-gatsby-site
    npm install
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.22 12:30:42