Installation and use of yarn

Source: Internet
Author: User
Tags microsoft sql server install node

What is Yarn installation Yarn initializing a new project summary

what is Yarn.

This refers to the description of the Civil service network:
Yarn is a dependency management tool. It manages your code and shares the code with developers around the world. Yarn is efficient, safe and reliable, and you can safely use it.

Yarn allows you to use code developed by other developers to make it easier for you to develop software. If you find any problems in use, welcome to send issue or contribute code, once the problem is fixed, you can continue to use Yarn fight.

Code is shared through packages (sometimes called modules). Each package contains all the code that needs to be shared, and a Package.json file is defined to describe the package. Install the Yarn installation tutorial Https://yarn.bootcss.com/docs/install.html#windows-tab

Here's a quick introduction to the process I used to install with Windows 10
1, download the installation program:
You can download an. msi file, which will guide you through the installation of Yarn.
If you use the Installer method, you need to first install Node.js.

Full default installation can be

Test to see if Yarn is working correctly:

D:\__demo\yarn-test>yarn–version

Results

D:\__demo\yarn-test>yarn-v
1.3.2

If the test is not successful, is generally the problem of environment variables, this is also a common problems with Windows, if the Mac will be better
command line setting environment variable

Open the DOS command window and enter the path command to view the existing environment variables

D:\__demo\yarn-test>path

Results

Path=c:\windows\system32; C:\WINDOWS; C:\WINDOWS\System32\Wbem; C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D: \application\git\cmd;d:\dev\node-v7.10.0-x64\;D: \application\ Tortoisegit\bin; C:\Program Files\Microsoft SQL Server\110\tools\binn\; C:\Program Files (x86) \microsoft Sdks\typescript\1.0\; C:\Program Files\Microsoft SQL Server\120\tools\binn\; C:\Program files\dotnet\;D: \application\yarn-1.3.2\bin; C:\Users\xhlm\AppData\Local\Microsoft\WindowsApps; C:\users\xhlm\appdata\roaming\npm;d:\application\microsoft VS Code\bin; C:\Users\xhlm\AppData\Local\Yarn\bin;

Setting environment variables

D:\__demo\yarn-test>set Path=c:\users\xhlm\appdata\local\yarn\bin;

Now that you've installed the Yarn, you can start using it. Here are some of the most common commands you'll need. Initialize a new project

Initialized command

D:\__demo\yarn-test>yarn Init

Results:

{
  "name": "No.1", "
  Version": "1.0.0",
  "description": "No.1 Yarn",
  "main": "Index.js",
  "author": "Heping",
  "license": "MIT"
}

Add a dependency pack

Yarn Add [Package]

Here with Gulp as chestnuts:

D:\__demo\yarn-test>yarn Add Gulp

If there is an error in the installation, yarn will automatically generate Yarn-error.log files in the engineering root directory, troubleshooting the problem is very convenient.

If you see such a directory structure, the operation is successful, here is only the interception of some of the DOS output log, too much, please understand:

...
├─user-home@1.1.1
├─util-deprecate@1.0.2
├─v8flags@2.1.1
├─vinyl-fs@0.3.14
├─vinyl@0.4.6
├─which@1.3.0
├─wrappy@1.0.2
└─xtend@4.0.1 in
20.62s.

Yarn Add [package]@[version]

Also carry the version of the command, get the fruit please own exquisite

D:\__demo\yarn-test>yarn Add gulp@3.9.1

Here's the tag, which refers to Beta, next, or latest, I used very little, welcome to the pointing ^_^:

Yarn Add [Package]@[tag]

Update a dependency package that is the same as the installation:

Yarn upgrade [Package]
Yarn upgrade [Package]@[version]
Yarn upgrade [Package]@[tag]

Delete a dependent package

Yarn Remove [Package]
D:\__demo\yarn-test>yarn Remove Gulp

Install all the dependent packages

Yarn

Or

Yarn Install

Directory structure

  .
  ├─node_modules
  ├─package.json
  └─yarn.lock
Package.json
  {
    "name": "No.1", "
    Version": "1.0.0",
    "description": "No.1 Yarn",
    "main": "Index.js",
    "author": "Heping",
    "license": "MIT",
    "dependencies": {
      "gulp": "3.9.1"
    }
  }
Summary

During the actual experience, yarn is really faster and simpler than NPM. NPM is slow because at present there is no CDN node, so download dependence is run abroad to go under, haha.

Original link-yarn installation and use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.