Introduction, installation and use of nodejs yarn

1 Introduction

Front-end development often needs to work with the back-end at the same time. Without the back-end, server communication and data acquisition for page rendering cannot be performed. The Node.js server written in Javascript, for front-end developers, can avoid the cost of learning server scripting language, and can build a complete and efficient Web service in a short time. NPM (Node Package Manager) came into being as a dependency package manager of Node.js, and YARN was designed and developed for some of the not-so-good parts of NPM.

2. Installation

For the installation of nodejs and npm, please refer to my blog post link How to use nvm to install nodejs under linux

npm install -g yarn --registry=https://registry.npm.taobao.org
配置源

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

yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g

3. Use

yarn lint 初始化 

yarn install 默认安装依赖

yarn add xxxx 安装某个依赖并保存

yarn global add xxxx  安装某个全局依赖

yarn remove xxxx 移除某个依赖

yarn upgrade xxxx 更新依赖

 yarn run 运行指令

yarn serve 开启web服务

yarn build 生成dist文件夹,编译web项目

Guess you like

Origin blog.csdn.net/weixin_44704985/article/details/113972336