当前位置:网站首页>Use NRM and NVM to manage your NPM source and node versions
Use NRM and NVM to manage your NPM source and node versions
2022-07-04 04:23:00 【Careteen】
Catalog
- Use nrm Manage your npm-registry
- Use nvm Manage your node edition
- Publish personal npm package
- Release
- to update
Use nrm Manage your npm-registry
npm Source abroad , For domestic developers , Downloading packages is often slow , and npm Often hang up .
Maybe before, we will point the source to Taobao source by doing the following , And then use cnpm operation , It can also be used very happily .
npm install -g cnpm --registry=https://registry.npm.taobao.org
We can also use tools nrm To change a npm Source , It provides the following sources for us to choose , It is more recommended to choose Taobao source .
Let's briefly talk about the installation and common commands
- Global installation npm install -g nrm
- Test the speed of each source nrm test
It can be seen that taobao It's the fastest
- View the source currently in use nrm current
- Use a source # Switch to Taobao source nrm use taobao
- Then use it normally in the corresponding project npm that will do $yourRepo npm install
- See help for more instructions nrm help
The more interesting statement is nrm To replace npm??? But nrm Is installed in mac and windows The next is to rely on npm Of . poof :)
Use nvm Manage your node edition
Yes cnpm Source management allows us to install packages faster . Similarly, we may have switching at ordinary times node Version of the scene . It can be used at this time nvm Manage it .
May sometimes use some based on Node When I use a low version of the encapsulated framework v0.10.32, But most of the time, I will use a newer version Node, At this time, I also hope to do version management .
- Global installation
npm install -g nvm
- see nvm edition
nvm -v
- Download the latest node edition
nvm install latest
- Check the existing version of the remote
# It could be very slow , Please be patient nvm ls-remote
- Download the specified version nodejs
nvm install v8.6.0 # The default is 64 position ,32 Bits need to be specified nvm install v8.6.0 32
- Current version used
nvm current
- Use the specified version
nvm use v8.6.0
- View the installed nodejs edition
nvm list # or nvm ls
- see nodejs edition
node -v
Publish personal npm package
about jser Come on , There are a lot of npm Dealing with bags , How to write a personal package and publish it to npm On the official website ?
You can go to One JS The viscera of the third-party library Check the details , Provides JS Third party warehouse scaffold Project , It's ready to use . Here is only for publishing npm Explanation .
Release
When you have finished one npm package After the development of , We need a npm account number , You can go to npm Official website register .
Then log in to the account
npm login
If you enter the account and password to log in, the following error will be reported
That means your present npm Source It's not the official website , If you use the above Use nrm Manage your npm-registry, We need to switch first npm Source
# Switch nrm use npm # Check to make sure that the current source is npm nrm current
After successful login
To publish
npm publish
Of course, you can also revoke one of your own npm package
# --force Parameter means mandatory npm unpulish --force
to update
stay package.json Of documents version Version of field management package .
aThe number in indicates the large version number . Generally, it is incremented when the project is updated after reconstruction .bThe number in indicates the minor version number . Generally, it is new API After the update, go to increment .cThe number in indicates that the minor version number is patched . It is generally to repair the current version bug Increase after .
Increase the management version number , We can't be stupid enough to manually modify this field every time we update .
Can pass npm version xxx Automatically increment .
As above, we can update the version through the words pointed by the three arrows
# Update large version v1.0.0 -> v2.0.0 npm version major # Update small version v2.0.0 -> v2.1.0 npm version minor # patch up v2.1.0 -> v2.1.1 npm version patch
And then release it
npm publish
Another mention package.json Prefix of version number in ~ and ^ The difference between .
"@careteen/type": "~0.1.2", "@careteen/match": "^0.2.0",
- Wave sign
~: Automatically update currentminorLatest version . It will be updated to0.1.xThe latest version . - Insert symbol
^: Automatically update currentmajorLatest version . It will be updated to0.x.xThe latest version .
边栏推荐
- Tcp- simple understanding of three handshakes and four waves
- Leetcode skimming: binary tree 04 (sequence traversal of binary tree)
- Redis:哈希hash类型数据操作命令
- 批处理初识
- Huawei cloud Kunpeng engineer training (Guangxi University)
- C语言单向链表练习
- leetcode刷题:二叉树07(二叉树的最大深度)
- (pointer) write a function to compare the size of strings by yourself, which is similar to StrCmp.
- RHCSA 08 - automount配置
- DP83848+网线热拔插
猜你喜欢

PostgreSQL users cannot create table configurations by themselves

leetcode刷题:二叉树09(二叉树的最小深度)

【微服务|openfeign】@FeignClient详解

透过JVM-SANDBOX源码,了解字节码增强技术原理

Global exposure and roller shutter exposure of industrial cameras

Introduction to asynchronous task capability of function calculation - task trigger de duplication

Brief explanation of depth first search (with basic questions)

Flink学习6:编程模型

There is a problem that the package cannot be parsed in the like project
Tcp- simple understanding of three handshakes and four waves
随机推荐
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
RHCSA 03 - 文件的基础权限
【读书会第十三期】视频文件的封装格式
统计遗传学:第三章,群体遗传
[Logitech] m720
STM32 external DHT11 display temperature and humidity
leetcode刷题:二叉树04(二叉树的层序遍历)
【罗技】m720
【华为云IoT】读书笔记之《万物互联:物联网核心技术与安全》第3章(上)
量子力学习题
How to add custom API objects in kubernetes (1)
【微服务|openfeign】@FeignClient详解
TCP-三次握手和四次挥手简单理解
R语言中如何查看已安装的R包
Programmers' telecommuting is mixed | community essay solicitation
Flink learning 8: data consistency
Spa in SDP
[microservices openfeign] two degradation methods of feign | fallback | fallbackfactory
JS实现文字滚动 跑马灯效果
Interpretation of leveldb source code skiplist