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

将Grafana插件从@grafana/toolkit迁移到create-plugin时Yarn报错求助

解决Grafana插件迁移报错:core-js-pure找不到binary

错误详情

执行yarn create @grafana/plugin migrate时出现如下错误:

C:\Users\mydir\my-plugin>yarn create @grafana/plugin migrate
yarn create v1.22.19
warning ..\..\..\..\..\..\..\package.json: No license field
[1/4] Resolving packages...
warning @grafana/create-plugin > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning @grafana/create-plugin > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @grafana/create-plugin > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
warning @grafana/create-plugin > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error C:\Users\AGaur\AppData\Local\Yarn\Data\global\node_modules\core-js-pure: Couldn't find the binary node -e "try{require('./postinstall')}catch(e){}"
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

解决方案

1. 验证Node.js环境配置

打开命令提示符,执行node -v,如果没有输出Node.js版本号,说明Node未添加到系统PATH中:

  • 重新安装Node.js,安装时务必勾选「Add to PATH」选项
  • 安装完成后重启终端,再次验证node -v是否正常输出

2. 清理Yarn缓存与项目依赖

  • 清理Yarn全局缓存:yarn cache clean
  • 删除项目目录下的node_modules文件夹和yarn.lock文件
  • 重新执行迁移命令:yarn create @grafana/plugin migrate

3. 更换包管理器或升级Yarn

  • 升级Yarn到最新版本:npm install -g yarn,之后再重试迁移命令
  • 改用npm执行迁移:npm create @grafana/plugin migrate

4. 手动修复core-js-pure包

  • 定位到报错路径C:\Users\AGaur\AppData\Local\Yarn\Data\global\node_modules\core-js-pure
  • 删除该目录下的所有文件
  • 重新执行迁移命令,让Yarn重新拉取完整的core-js-pure包

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 01:23:27