当前位置:网站首页>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 .
a
The number in indicates the large version number . Generally, it is incremented when the project is updated after reconstruction .b
The number in indicates the minor version number . Generally, it is new API After the update, go to increment .c
The 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 currentminor
Latest version . It will be updated to0.1.x
The latest version . - Insert symbol
^
: Automatically update currentmajor
Latest version . It will be updated to0.x.x
The latest version .
边栏推荐
- 思考的小记录
- 三年进账35.31亿,这个江西老表要IPO了
- Two commonly used graphics can easily realize data display
- 【读书会第十三期】视频文件的封装格式
- leetcode 121 Best Time to Buy and Sell Stock 买卖股票的最佳时机(简单)
- Evolution of MySQL database architecture
- 北漂程序员,月薪20K,一年攒15W,正常吗?
- Spa in SDP
- vim正确加区间注释
- [microservice openfeign] @feignclient detailed explanation
猜你喜欢
What does software testing do? Find defects and improve the quality of software
The maximum expiration time of client secret in azure ad application registration is modified to 2 years
I Build a simple microservice project
毕业设计项目
Flink学习6:编程模型
2021 RSC | Drug–target affinity prediction using graph neural network and contact maps
2020 Bioinformatics | TransformerCPI
架构训练毕业设计+总结
Keysight N9320B射频频谱分析仪解决轮胎压力监测方案
透过JVM-SANDBOX源码,了解字节码增强技术原理
随机推荐
One click compilation and deployment of MySQL
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
Two commonly used graphics can easily realize data display
Redis:集合Set类型数据的操作命令
Pointer array and array pointer
Flink学习7:应用程序结构
dried food! Generation of rare samples based on GaN
Activiti7 task service - process variables (setvariable and setvariablelocal)
VIM mapping command
JS realizes the effect of text scrolling marquee
I Build a simple microservice project
(指針)自己寫一個比較字符串大小的函數,功能與strcmp類似。
Unity draws the trajectory of pinball and billiards
【微服务|openfeign】feign的两种降级方式|Fallback|FallbackFactory
Keysight N9320B射频频谱分析仪解决轮胎压力监测方案
【读书会第十三期】视频文件的封装格式
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
一个漂亮的API文档生成工具
Why is the probability of pod increasing after IPtable
[csrf-01] basic principle and attack and defense of Cross Site Request Forgery vulnerability