使用Ant Design Pro部署项目有关npm版本的一些问题
这个项目来自 Ant Design Pro.点击此链接可以查看具体用法
使用了nvm,node,npm,nvm用来方便控制node版本
C:\Users\lixinrun>nvm ls
* 18.19.1 (Currently using 64-bit executable)
16.20.2
C:\Users\lixinrun>nvm -v
1.1.12
C:\Users\lixinrun>npm -v
10.2.4
C:\Users\lixinrun>node -v
v18.19.1
新建一个项目文件
初始化脚手架
npm i @ant-design/pro-cli -g
使用18版本的node运行下面代码创建项目文件可能会报错
pro create myapp
可以使用下面的代码运行
npx pro create myapp
环境准备
安装 node_modules
:
npm install
上面代码不行的话使用下面的可以,上面查询的原因是因为npm和yarn冲突了,使用下面可以忽略冲突
npm install --legacy-peer-deps
or
下面这个也可以
yarn
Provided Scripts
Ant Design Pro provides some useful script to help you quick start and build with web project, code style check and test.
Scripts provided in package.json
. It’s safe to modify or add additional script:
Start project
npm start
启动后若出现git不存在的问题
fatal: not a git repository (or any of the parent directories): .git
在命令行 输入 git init 然后回车就好了
git init
总结来说,使用16.20.2版本的node跟着 Ant Design Pro.说明书走基本不会出差