赞
踩
Install yarn: NPM install -g yarn
View the version number: yarn --version
Create a folder: md yarn
Go to the folder: cd yarn
Project initialization: (Generate package.json file)
Yarn configuration items:
Yarn install // Install all packages in package.json and store all dependencies to yarn.lock
Yarn Install -- Flat // Installs a single version of a package
Yarn install ---force // Forcibly downloads all packages again
Yarn install --production // Install only the package in Dependencies
Yarn install --no-lockfile // Do not read or generate yarn.lock
Yarn install --pure-lockfiles // Yarn.lock is not generated
Add a package:
Yarn add --dev / -d // Add to devDependencies
Yarn add --peer / -p // Add to peerDependencies
Yarn add -- --optional / -o // Add to optionalDependencies
Publish a package:
yarn publish
To remove a bag:
yarn remove <packageName> // Package.json and yarn.lock are automatically updated when a package is removed
The attached pictures are interpreted in Chinese for YARN:
- 安装yarn: npm install -g yarn
- 查看版本号; yarn --version
- 创建文件夹; md yarn
- 进入文件夹: cd yarn
- 项目初始化;(生成package.json文件)
- yarn的配置项:
- yarn install //安装package.json里所有包,并将所有依赖项存入yarn.lock
- yarn install ---flat 安装一个包的单一版本
- yarn install ---force 强制重新下载所有包
- yarn install ---production //只安装dependencies里的包
- yarn install ---no-lockfile //不读取或生成yarn.lock
- yarn install ---pure-lockfiles //不生成yarn.lock
- 添加包:
- yarn add ---dev /-D //添加到devDependencies
- yarn add ---peer /-P //添加到peerDependencies
- yarn add ---optional /-O //添加到optionalDependencies
- 发布包;
- yarn publish
- 移出一个包:
- yarn remove <packageName> //移出一个包,会自动更新package.json和yarn.lock

### NPM common command
NPM init // Create packge.json
NPM install package name // download | installation package
NPM install -s // Download the package and save it to the run dependency
NPM install -d // Download the package and save it to the development dependency
NPM install Install package name@version // Download a fixed version of the package
NPM view Package name versions // Lists all package versions
NPM install // Installs all packages recorded in package.json at once
The attached pictures are interpreted in Chinese for NPM
- npm init //创建packge.json
- npm install 包名 //下载|安装包
- npm install 包名 -S //下载包并保存到运行依赖
- npm install 包名 -D //下载包并保存到开发依赖
- npm install 包名@版本号 //下载固定版本的包
- npm view 包名 versions //列举出包的所有版本信息
- npm install //一次性安装所有package.json中记录的所有包
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。