NPM 命令 和 Vue 创建项目
1.查看环境
node -v node版本
npm -v npm版本 node自带的
2.使用淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
3.查看镜像地址
npm config get registry
4.设置镜像地址
npm config set registry https://registry.npm.taobao.org
cnpm config set registry https://registry.cnpm.taobao.org
5.查看脚手架
vue -V
6.卸载脚手架
npm uninstall -g vue-cli --老方法安装 过气了
npm uninstall -g @vue/cli --3.0X 以上版本
7.安装脚手架
npm install -g @vue/cli vue -V 查看 @vue/cli 5.0.4
8.创建Vue 项目
vue create projectName #必须英文 eg: vue create my-project
name can no longer contain capital letters 名称不能再包含大写字母 操!!!
9.开始进入问答模式
我选择Vue 2.
直接就生成了,创建项目XXX,初始化git 仓储,真快啊~~~
45S 真男人,切换到XXX,npm run serve 运行。
在浏览器 复制http://localhost:8080/
10. vue ui 用浏览器界面创建项目
cmd-->vue ui
浏览器输入 http://localhost:8000 一直在加载,就是没反应。应该是过气了吧!!!
11. 查看npm安装包的路径
npm ls -g
12.'grunt' 不是内部或外部命令,也不是可运行的程序
npm install -g grunt-cli
13. npm install 报错
PS D:\chrome DownLoad\MAP\jqvmap-master> npm install Debugger attached. npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: jqvmap@1.5.1 npm ERR! Found: grunt@0.4.5 npm ERR! dev grunt@"^0.4.5" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer grunt@">=1.4.1" from grunt-contrib-concat@2.1.0 npm ERR! node_modules/grunt-contrib-concat npm ERR! dev grunt-contrib-concat@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See C:\Users\Fairyland\AppData\Local\npm-cache\eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Fairyland\AppData\Local\npm-cache\_logs\2022-04-07T07_25_11_336Z-debug.log Waiting for the debugger to disconnect...
原因:等依赖项中存在无法解决的冲突 ,这是因为从github中拉去下来的项目。npm i 报错
解决:使用 npm i --legacy-peer-deps。
14.npm 安装确定的版本
npm i install fabric@4.6.0 -S
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?