This is the fourth day of my participation in the August Text Challenge.More challenges in August
Yarn is a package manager for code that allows you to use code from developers around the world or share your own code.
Yarn provides fast, secure, and reliable performance.
Yarn allows you to use other developers’ solutions to different problems to make your development process easier.
Code is shared through packages, or modules.
A package contains all the code that needs to be shared, along with a file that describes the package information, called package.json.
When encountering problems, you can report them or contribute solutions. Once the problem is fixed, Yarn updates to keep it in sync.
Configuring a domestic mirror
1. View the mirror source in use
yarn config get registry
Copy the code
2. Run the Yarn command to modify the image (mode 1).
yarn config set registry https://registry.npm.taobao.org/
Copy the code
3. Third-party tool YRM manages image sources (Recommended in Method 2)
3.1 Installing the Node.js Environment
Installation instructions :(1) node.js installation instructions
3.2 installation yrm
sudo npm install -g yrm
Copy the code
3.3 Listing All Mirror Sources
yrm ls
Copy the code
3.4 Switching Mirrors
yrm use taobao
Copy the code
3.5 Adding a Mirror
yrm add mumway http://maven.aliyun.com/nexus/content/groups/public
Copy the code
3.6 Deleting a Mirror
yrm del taobao
Copy the code
3.7 Test Delay (access speed) :
yrm test mumway
Copy the code
3.8 Viewing Help:
yrm -h
Copy the code
Solution for most NPMS unable to download packages
1. Temporary use
npm --registry https://registry.npm.taobao.org install express
Copy the code
2. The NPM fails to be installed
NPM installation error
npm --registry http://op-npm.mumway.com/ i hybase_miniapp_common
Copy the code
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which has since been addressed. To permanently fix this problem, please run: npm ERR! sudo chown -R 501:20 "/Users/lishuangshuang/.npm"
Copy the code
CNPM installation
cnpm --registry http://op-npm.mumway.com/ i hybase_miniapp_common
Copy the code
An error
Unable to authenticate, your authentication token seems to be invalid. npm ERR! To correct thi
Copy the code
To permanently resolve the above problem, grant permissions to the root NPM file
sudo chown -R 501:20 "/Users/xxx/.npm"
Copy the code
To perform
npm --registry http://op-npm.mumway.com/ i hybase_miniapp_common
Copy the code
The installation succeeded message is displayed.