zoukankan      html  css  js  c++  java
  • Ubuntu20.04安装yarn报错gpg: can't connect to the agent: IPC connect call failed(已解决)

    最近进行新项目的开发学习,用到yarn,mark一下安装过程。

    例行科普,首先介绍一下yarn:

    1.  YarnFacebook等公司开发的用于替换npm的包管理工具;
    2. 速度快:并行安装 + 离线模式(缓存);
    3. 版本统一。

    习惯用npm的同学,对命令的学习可以自行参考记忆,以下是常用命令:

    npm init                                     ---- yarn init
    npm install                                  ---- yarn 
    npm install xxx@1.1.1 -g                     ---- yarn global add xxx@1.1.1
    npm install xxx@1.1.1 --save                 ---- yarn add xxx@1.1.1
    npm install xxx@1.1.1 --save-dev             ---- yarn add xxx@1.1.1 --dev
    npm uninstall xxx --save(-dev)               ----yarn remove xxx
    npm run xxx                                  ---- yarn run xxxx

    接下来就进入安装正题了!

    Yarn官网安装下载地址:https://yarn.bootcss.com/docs/install/#debian-stable

    按照官网要求一步一步来:

    首先选择适合你操作系统的安装包,我选择了ubuntu操作系统的稳定版本。

    在Debian或Ubuntu Linux上,通过Debian软件包存储库安装Yarn。首先配置存储库:

    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

    结果第一步就报错了:

    发现报错:

    gpg: can't connect to the agent: IPC connect call failed  // gpg:无法连接到代理:IPC连接调用失败

    在网上谷歌了半天,先是启动 gpg agent: gpg-agent –daemon ,然而无效。

    陆陆续续查了很多修改方法,最后下面这个方法奏效了(注意获取root权限):

    sudo apt remove gpg
    
    sudo apt install gnupg1

    然后继续执行后续步骤:
    echo"deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
    报错消失不见了!接着继续
    sudo apt update &&sudo apt install yarn

    通过如下命令测试 Yarn 是否安装成功:

    安装成功! 环境变量测试我直接跳过了,网上很多大佬都没提到这一点设置并且亲测不影响yarn使用。

    最后更新淘宝源:

    yarn config get registry
    # https://registry.yarnpkg.com
    
    yarn config set registry https://registry.npm.taobao.org
    
    yarn config get registry
    # https://registry.npm.taobao.org
  • 相关阅读:
    python_网络编程struct模块解决黏包问题
    python_网络编程socket(UDP)
    python_网络编程socket(TCP)
    python_面向对象
    python_生成器
    python_迭代器
    linux实操_shell自定义函数
    linux实操_shell系统函数
    linux实操_shell读取控制台输入
    scrapy-redis 0.6.8 配置信息
  • 原文地址:https://www.cnblogs.com/lynn-z/p/12893810.html
Copyright © 2011-2022 走看看