Yarn 安装管理

  1. 安装
    1. 源管理
    2. npm安装yarn
    3. yarn 使用
    4. debug解决

安装

源管理

# 查询当前源
yarn config get registry

# 更换国内源(淘宝)
yarn config set registry https://registry.npmmirror.com

# 恢复官方源
yarn config set registry https://registry.yarnpkg.com

# 删除源,会回复默认官方源
yarn config delete registry

# 设置项目源
# 项目目录下新建 .yarnrc 文件
registry "https://registry.npm.taobao.org"
sass_binary_site "https://npm.taobao.org/mirrors/node-sass/"

npm安装yarn

# npm安装yarn,使用淘宝npm
npm install -g yarn --registry=https://registry.npmmirror.com

# 查看版本
yarn -version
yarn -v

yarn 使用

# 安装所有依赖
yarn install

# 启动项目
yarn start

# 打包项目
yarn build

debug解决

# 启动警告提示:Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.
# 解决:
npm config set scripts-prepend-node-path true

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 [email protected]

×

喜欢就点赞,疼爱就打赏