当前位置:网站首页>Explain four interesting NPM usages with charts
Explain four interesting NPM usages with charts
2022-07-26 13:48:00 【Ink fragrance^_^】
1、 npm add to === npm install
If you try to npm Search in official documents npm add command , You will find that this command doesn't seem to exist at all , Here's the picture :

But we can use this command on the terminal :
$ npm add lodashactually ,npm add yes npm install One of the aliases of . So when we use npm add when , Exactly equivalent to npm perform npm install !
Again ,npm i It's also npm install Another name for .

2、npm instal ? No problem
Careful readers may have found out , The installation in the subtitle above is a misspelling of this word . But it does work .
$ npm instal lodashActually, this is npm 8.x A new feature of version , It's called fault tolerant design . If the user accidentally misspells a word ,NPM It still works .
So in 8.x In the version ,npm install Got it 9 An alias , Namely :
in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
3、 You can perform some additional actions before and after each script execution
Suppose we have a name greet Script for :

Now we want to :
stay greet Output something before execution : stay greet Before doing something ;
stay greet Output something after execution : stay greet Then do something .
So what should we do ?
We can add a pregreet Script and a postgreet Script , This is a NPM The mechanism of , With pre and post The first script is considered a special script .


This mechanism is often used in the automatic deployment of projects .
4、 Use npm link Install some terminal commands
If you are in the project package.json In the definition of bin Property and point it to the executable script file .
for example :
package.json :
{"name": "npm-test","bin": {"hello-npm-1": "./build/hello.sh"}}
hello.sh :
echo "hello npm"And then we can use it npm link Install it to shell In command :

In the figure :

This is how to install create-react-app and vue-cli The way .
边栏推荐
- How to build a customer-centric product blueprint: suggestions from the chief technology officer
- 搞懂MySQL的数据类型中长度含义
- 历时15年、拥有5亿用户的飞信,彻底死了
- 带你熟悉云网络的“电话簿”:DNS
- Zhou Wei: look for non consensual investment opportunities to accompany the founding team that delays satisfaction
- LCL three-phase PWM rectifier (inverter)
- 最新战报:十项认证,五项最佳实践
- 循环队列(c语言实现)
- Docker container MySQL enables binlog and scheduled backup
- 飞盘,2022年“黑红”顶流
猜你喜欢

See you tomorrow at the industrial session of cloud intelligence technology forum!

Time complexity and space complexity

官宣!艾德韦宣集团与百度希壤达成深度共创合作

【黑马早报】字节旗下多款APP下架;三只松鼠脱氧剂泄露致孕妇误食;CBA公司向B站索赔4.06亿;马斯克否认与谷歌创始人妻子有婚外情...

Brief introduction of reflection mechanism

In 2022, we "sent away" so many Internet products in only one month

Seven steps to copywriting script ---- document team collaborative management

【Oauth2】七、微信OAuth2授权登录

循环队列(c语言实现)

Comparison between SIGMOD function and softmax function
随机推荐
Detailed relation extraction model casrel
Canvas upload image Base64 with cropping function jcrop.js
B+ tree selection index (2) -- MySQL from entry to proficiency (23)
Sword finger offer (IX): abnormal jumping steps
【Oauth2】五、OAuth2LoginAuthenticationFilter
Pytoch learning notes (II) the use of neural networks
See you tomorrow at the industrial session of cloud intelligence technology forum!
详解关系抽取模型 CasRel
[beauty of open source] nanomsg (2): req/rep mode
力扣------字符串中的单词数
JS page turning, kkpager.js page turning
The use of asynchronous thread pool in development
Brief introduction of reflection mechanism
Multithreaded completable future usage
Pytorch学习笔记(二)神经网络的使用
The.Net webapi uses groupname to group controllers to render the swagger UI
Pytoch learning notes (I) installation and use of common functions
Uncover the secret of white hat: 100 billion black products on the Internet scare musk away
Ten thousand words long article, talking about the blueprint of enterprise digital modeling
Click El dropdown item/@click.native