Foreword
What yarn that?
Is simple and npm same package management tools, and npm some drawbacks and provide optimized solutions
yarn and npm difference?
Installation faster cache for each downloaded package, without re-downloading when used again. While taking advantage of parallel downloads to maximize resource utilization,
Verifies the integrity and unity of each front installation package to run code, so that on different systems can work indiscriminately
The most common yarn most basic commands and contrast npm
npm init / yarn init initialization
mkdir file name / md file name
npm install / yarn or yarn install mounted reliance
npm install package --save-dev / yarn add package --dev mounting a dependency
npm uninstall package --save-dev / yarn remove package --dev uninstall a dependent
npm run dev or npm start / yarn run start or yarn start running
Installation yarn error
If npm install yarn -g installation error, suggesting that not enough you permission,
Probably because npm can not node_modules access to the global directory of the local caused
Solution
Official recommended method to use, depending on your system to install the Yarn https://yarn.bootcss.com/ , but because I was lazy, chose the most simple and crude methods
Before installing the top with command sudo (I am a linux system, windos do not add sudo such instructions elevate administrator privileges directly npm install it)
npm install -g the Yarn sudo , after the installation yarn -v view the version to determine if the installation was successful
supplement
If you add sudo can not resolve, you can refer to the following link in the method