当前位置:网站首页>Execution process of NPM run XX
Execution process of NPM run XX
2022-07-25 05:06:00 【rananie】
List of articles
npm run xx The implementation process of
npm run xxx This xxx Is in package.json Configured in .
package.json Medium scripts Medium key by xxx,value For actual commands .
npm run xxx When , I will go to the project first package.json Look for... In the file scripts Find the corresponding xxx, And then execute xxx The order of , For example, start vue project npm rum serve Actually npm run vue-cli-service serve --open
vue-cli 2.0
"script":{
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node build/build.js"
}
vue-cli 3.0
"script":{
"serve": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
}
Why not do it directly vue-cli-service serve But to execute npm run serve Well
Because there is no vue-cli-service Instructions , Direct execution will report an error .
** Why execute npm rum serve You can make it when you want to ?
**
When installing dependencies , Will be in node_modules/.bin/ Create several in the directory vue-cli-service Executable named ,bin The files in the directory represent soft connection .
Use npm run serve perform vue-cli-service serve when , Will arrive ./node_modules/.bin Find vue-cli-service. File as Script to execute , It is equivalent to the execution of ./node_modules/.bin/vue-cli-service serve( final serve Pass in as a parameter )
This bin Where did the soft link files in the directory come from ? How does it know where this soft connection is executed ?
Source code in the Library package.json in , Can find bin Field , Used to create a soft link during installation to point to bin Address in .
npm i When ,npm Just help us configure this soft connection , In fact, this kind of soft connection is equivalent to a mapping , perform npm run xxx When , It will come to node_modules/bin Find the corresponding mapping file in , Then find the corresponding js File to execute .
author : Sunshine is sunny link :https://juejin.cn/post/7078924628525056007 source : Rare earth digs gold The copyright belongs to the author . Commercial reprint please contact the author for authorization , Non-commercial reprint please indicate the source .
边栏推荐
- Wechat official account all article download links to get
- Logu p3398 hamsters find sugar solution
- Learning records [email protected] R & D effectiveness measurement indicators
- STM32 development note 117: generate IIR low-pass filter coefficients using MATLAB
- Tiny-emitter.js: a small event subscription and Publishing Library
- 深入掌握Service
- 2022-07-24: what is the output of the following go language code? A:[]int{}; B:[]int(nil); C:panic; D: Compilation error. package main import ( “fmt“ ) f
- Permanent magnet synchronous motor 36 question (1) -- what is the difference between salient pole motor and salient pole motor?
- The second day of rhcsa summer vacation
- Anaconda installs jupyter
猜你喜欢

After watching the latest interview with big manufacturers, these six JVM interview questions were asked

When we talk about immutable infrastructure, what are we talking about

Ffmpeg download and installation

Ownership in rust -- introduction of rust language Xiaobai 11

rhce第一天

Basic knowledge of scratch crawler framework

OA and fansoft Bi cross system users, departments and posts synchronous summary

Style transfer -- CCPL: contrast coherence preserving loss for versatile style transfer

2022-7-15 summary

Data link layer protocol -- Ethernet protocol
随机推荐
Get the parameters of the browser address bar
Interviewer: explain the core principle of ThreadLocal
Dragon Dragon community released the first Anolis OS Security Guide to escort users' business systems
How to publish your own NPM package
Anaconda installs jupyter
Introduction to fundamentals of operations research [1]
Redis集群搭建(Windows)
推荐系统-协同过滤在Spark中的实现
Actual combat | record an attack and defense drill management
5年经验的大厂测试/开发程序员,怎样突破技术瓶颈?大厂通病......
How can test / development programmers with 5 years of experience break through the technical bottleneck? Common problems in big factories
IT自媒体高调炫富,被黑客组织盯上,铁定要吃牢饭了…
Leetcode55. Jumping game
Pyg builds GCN to realize link prediction
The second day of rhcsa summer vacation
Teach you how to locate unreasonable SQL? And optimize it
[analysis of GPIO register (crl/crh) configuration of STM32]
2022-07-24: what is the output of the following go language code? A:[]int{}; B:[]int(nil); C:panic; D: Compilation error. package main import ( “fmt“ ) f
Set up private CA server
An article takes you to understand the sentinel mode of redis