使用thirdweb创建合约报错:Cannot read properties of undefined
解决thirdweb CLI创建合约时的"Cannot read properties of undefined (reading 'statusCode')"错误
错误原因
该报错源于thirdweb CLI在执行版本更新检查时,网络请求未正常返回结果,导致update-notifier模块无法读取响应的statusCode属性。
解决步骤
跳过版本检查执行命令
直接禁用更新检查功能,Windows系统执行:set NO_UPDATE_NOTIFIER=true && npx thirdweb@latest create --contractLinux/Mac系统执行:
NO_UPDATE_NOTIFIER=true npx thirdweb@latest create --contract清理npm缓存
执行缓存清理命令后重新运行创建指令:npm cache clean --force npx thirdweb@latest create --contract指定稳定版本的thirdweb CLI
若最新版本存在兼容性问题,可尝试使用已知稳定的版本:npx thirdweb@0.10.19 create --contract检查网络与npm源
- 测试npm registry连通性:
npm view thirdweb version - 若连通失败,切换至国内镜像源:
npm config set registry https://registry.npmmirror.com/ - 重新运行创建合约命令
- 测试npm registry连通性:
内容的提问来源于stack exchange,提问作者Parth Fadadu
相关产品推荐
相关产品推荐

