Centos7安装yarn 您所在的位置:网站首页 node怎么安装yarn Centos7安装yarn

Centos7安装yarn

2023-08-14 23:41| 来源: 网络整理| 查看: 265

Centos7安装yarn 设置Yarn仓库 curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo 如果还没有安装node.js,再设置一下设置node仓库 curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash - 开始始安装 sudo yum install yarn ## OR ## sudo dnf install yarn

如果未在 PATH 环境变量中找到 yarn,请按照以下步骤添加 yarn 到 PATH 环境变量中,使其可以随处运行。

注意:您的配置文件可能是 .profile、.bash_profile、.bashrc、.zshrc 等。

将此项加入您的配置文件: export PATH="$PATH:/opt/yarn-[version]/bin" (路径可能根据您安装 Yarn 的位置而有差异) 在终端中,执行登录并登出以使更改生效

为了可以全局访问 Yarn 的可执行文件,你需要在控制台(或命令行)中设置 PATH 环境变量。若要执行此操作,请添加 export PATH="$PATH:yarn global bin" 到你的配置文件中,或者,如果你使用的是 Fish shell,直接执行此命令 set -U fish_user_paths (yarn global bin) $fish_user_paths 即可。

通过如下命令测试 Yarn 是否安装成功: yarn --version 国内镜像加速 yarn config set registry https://registry.npm.taobao.org 使用 Yarn 安装依赖 SASS_BINARY_SITE=http://npm.taobao.org/mirrors/node-sass yarn

在 yarn 命令前添加 SASS_BINARY_SITE=http://npm.taobao.org/mirrors/node-sass 的目的是告诉 yarn 到淘宝的镜像去下载 node-sass 二进制文件。

安装过程可能会报

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=10.14". Got "8.17.0" error Found incompatible module.

执行如下命令,然后重新安装

yarn config set ignore-engines true


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有