yarn包管理器的使用

el/2023/9/24 22:50:24

一,yarn的相关配置和查看

查看配置列表

yarn config list

npm config npm

修改包的下载服务器地址,配置淘宝的镜像

yarn config set registry https://registry.npm.taobao.org

二.yarn的使用

1、yarn初始化一个项目(在项目目录下):yarn init
2、yarn添加依赖包:
yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]
3、yarn将依赖项添加到不同依赖项类别中:
dependencies类别:yarn add [package] --save(简写 -S)
devDependencies类别:yarn add [package] --dev(简写 -D)
peerDependencies类别:yarn add [package] --peer
optionalDependencies类别:yarn add [package] --optional
4、Yarn升级依赖包:
yarn upgrade [package]
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]


http://www.ngui.cc/el/3419169.html

相关文章

有关keep-alive缓存路由的各种用法

keep-alive基本用法 include - 字符串或正则表达式。只有名称匹配的组件会被缓存。 exclude - 字符串或正则表达式。任何名称匹配的组件都不会被缓存。 max - 数字。最多可以缓存多少组件实例。 主要用于保留组件状态或避免重新渲染。 <!-- 基本 --> <keep-alive>…

uni-app,Hbuilder编辑器中运行微信小程序开发者工具调试窗口,报错

首先感谢这位大神的分享&#xff0c;原地址在这&#xff1a; https://segmentfault.com/a/1190000023191861 解决方式&#xff1a; 打开微信开发者工具&#xff0c;找到设置的安全设置&#xff1a; 选择安全&#xff0c;启动服务端口

vuecli3.0 引入vant报错Cannot find module ‘babel-plugin-import‘ from

是因为没有安装 babel-plugin-import 运行命令 yarn add babel-plugin-import

Cannot read property ‘cancelToken‘ of undefined“

是因为在添加请求拦截器的时候&#xff0c;最后没有添加返回值return config方法 正确的写法应该是: axios.interceptors.request.use((config)>{ if(getStore(‘token’)){ config.headers.AuthorizationgetStore(‘token’); } return config; },(error)>{ console.log…

使用map的方式将数组中的对象,提取出来,转化成数组

如下&#xff1a; let imageList:[ { url:"first" }, { url:"second" } ] //这是第一种方法&#xff0c;是缩写 imageList.map(item>item.url); //第二种方法是全写 imageList.map((item)>{ return item.url; }) 输出的内容为&#xff1a;

uni-app实现多个图片预览

html的写法&#xff1a; <view > <image click"openImg(indexUrl,itemImg.url)" v-for"(itemImg,indexUrl) in info.images" class"w-100" mode"widthFix" :key"indexUrl" :src…

js中判断值的各种方式

//1.判断两个值是否相等 let v1,x2,s1; object.is(v,x) //false object.is(v,s) //true //2.判断json中是否包含某个键 let tt{xx:123,cc:‘3’’}; tt.xxd’’;’ tt.hasOwnProperty(‘xx’); //true tt.hasOwnProperty(‘xxd’);//true tt.hasOwnProperty(‘hasOwnProp…

@vue/cli卸载后安装新版本,无法卸载解决方式

今天更新vue/cli时&#xff0c;遇到问题&#xff1a;卸载不掉旧版本4.0 运行了npm uninstall vue/cli -g&#xff0c;之后&#xff0c;居然是up to date in,或者是显示删了很多文件&#xff0c;但是一运行 vue -V依然是可以查看版本的&#xff0c;说明没有卸载掉 以下方法可成…

VUE父级使用子组件以插槽的形式,在父级修改内容任意向子级插入

**父级组件的写法&#xff1a;** 子组件是firstSon <template> <div> <first-son> //向子组件中插入此内容 <div slot"firstcontent"></div> </first-son> </div&…

Map转成JSON对象

实际场景&#xff1a; 后端接口需要你传的参数是以上类型&#xff0c;由于是答题的场景&#xff0c;每次点击下一题则自动将题号作为键&#xff0c;选项作为值传入&#xff0c;等待所有题目答完统一传给后端 let val11; let val22; let zhinew Map(); //map追加值得方式 zhi.…