当前位置:   article > 正文

Explanation of the YARN & NPM command - - Collin‘s first article_collin外部命令安装

collin外部命令安装

Authorship: Collin.Yang 

Note to readers: Notes with a green background

acquaintance yarn 

### yarn common commands: 

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:

  1. 安装yarn: npm install -g yarn
  2. 查看版本号; yarn --version
  3. 创建文件夹; md yarn
  4. 进入文件夹: cd yarn
  5. 项目初始化;(生成package.json文件)
  6. yarn的配置项:
  7. yarn install //安装package.json里所有包,并将所有依赖项存入yarn.lock
  8. yarn install ---flat 安装一个包的单一版本
  9. yarn install ---force 强制重新下载所有包
  10. yarn install ---production //只安装dependencies里的包
  11. yarn install ---no-lockfile //不读取或生成yarn.lock
  12. yarn install ---pure-lockfiles //不生成yarn.lock
  13. 添加包:
  14. yarn add ---dev /-D //添加到devDependencies
  15. yarn add ---peer /-P //添加到peerDependencies
  16. yarn add ---optional /-O //添加到optionalDependencies
  17. 发布包;
  18. yarn publish
  19. 移出一个包:
  20. yarn remove <packageName> //移出一个包,会自动更新package.json和yarn.lock

npm common commands

### 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

  1. npm init //创建packge.json
  2. npm install 包名 //下载|安装包
  3. npm install 包名 -S //下载包并保存到运行依赖
  4. npm install 包名 -D //下载包并保存到开发依赖
  5. npm install 包名@版本号 //下载固定版本的包
  6. npm view 包名 versions //列举出包的所有版本信息
  7. npm install //一次性安装所有package.json中记录的所有包
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/273910
推荐阅读
相关标签
  

闽ICP备14008679号