下载源码
官网下载源码地址:
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...
完
如果您觉得帮助到您,感谢【一键三连】么么哒
版权声明:本文为SubStar原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。