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

编程知识 行业动态 更新时间:2024-06-13 00:19:23

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

  • 下载源码
  • 运行源码
  • 运行源码报错
  • 成功运行

下载源码

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

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

没有git的直接下载源码

运行源码

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

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

# 还可以设置一下yarn的国内镜像
yarn config set registry https://registry.npm.taobao -g
yarn config set sass_binary_site http://cdn.npm.taobao/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/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

# 还可以设置一下yarn的国内镜像
yarn config set registry https://registry.npm.taobao -g
yarn config set sass_binary_site http://cdn.npm.taobao/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...


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

更多推荐

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

本文发布于:2023-03-28 06:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/5f08c7ebe12f4b3e376470c2db6bf787.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:报错   源码   failed   exit   Command

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!