Vue3运行源码-调试报错:Command failed with exit code 128: git rev-parse HEAD

Vue3运行源码-调试报错:Command failed with exit code 128: git rev-parse HEAD

下载源码

官网下载源码地址:https://github.com/vuejs/vue-next

有git的可以克隆:git clone https://github.com/vuejs/vue-next.git

没有git的直接下载源码
在这里插入图片描述

运行源码

使用如下命令在cmd中执行,前提是先安装Node.js

# 如果没有安装yarn的需要安装一下
npm install -g yarn --registry=https://registry.npm.taobao.org

# 还可以设置一下yarn的国内镜像
yarn config set registry https://registry.npm.taobao.org -g
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g

# 安装依赖
yarn

# 运行
yarn run dev

运行源码报错

运行出现如下错误:

yarn dev
yarn run v1.22.10
$ node scripts/dev.js
C:\Users\star\Documents\project\vue-next-master\node_modules\execa\index.js:205
                throw error;
                ^

Error: Command failed with exit code 128: git rev-parse HEAD
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
HEAD
    at makeError (C:\Users\star\Documents\project\vue-next-master\node_modules\execa\lib\error.js:59:11)
    at Function.module.exports.sync (C:\Users\star\Documents\project\vue-next-master\node_modules\execa\index.js:188:17)
    at Object.<anonymous> (C:\Users\star\Documents\project\vue-next-master\scripts\dev.js:25:22)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  shortMessage: 'Command failed with exit code 128: git rev-parse HEAD',
  command: 'git rev-parse HEAD',
  exitCode: 128,
  signal: undefined,
  signalDescription: undefined,
  stdout: 'HEAD',
  stderr: "fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.\n" +
    "Use '--' to separate paths from revisions, like this:\n" +
    "'git <command> [<revision>...] -- [<file>...]'",
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

C:\Users\star\Documents\project\vue-next-master>git rev-parse HEAD
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
HEAD

看原因是因为git仓库获取不到head信息,所有就初始化仓库并提交到本地仓库中

# 运行源码需要Git仓库
git init
git add .
git commit "初始化项目"

# 如果没有安装yarn的需要安装一下
npm install -g yarn --registry=https://registry.npm.taobao.org

# 还可以设置一下yarn的国内镜像
yarn config set registry https://registry.npm.taobao.org -g
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g

# 安装依赖
yarn

# 运行
yarn run dev

成功运行

这时候运行就成功了,运行成功出现如下信息:

rollup v2.38.5
bundles C:\Users\star\Documents\project\vue-next-master\packages\vue\src\index.ts → packages\vue\dist\vue.global.js...
created packages\vue\dist\vue.global.js in 11.5s

[2021-05-02 22:00:57] waiting for changes...


如果您觉得帮助到您,感谢【一键三连】么么哒

  • 5
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Java全栈开发架构师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值