728x90
728x90

NPM

npm: the ubiquitous pakage manager for Node packages

→ how we’ll get and install Express


HOW to get install npm

To get and install Express using npm, open a terminal and type npm install express. This will download the latest version of Express and install it in your project's node_modules

in the wry tradition of PHP, GNU , WINE and others, “npm” is not an acronym ; rather, it is a recursive abbreviation for npm is not an acronym.

broadly speaking, a package managers’s two primiary responsibilities are instaling packages and manging dependencies. npm is a fast, capacle, and painless package manager

which i feel is in large part responsible for the rapid growth and diversity of the Node ecosystem.


when does npm installed?

is installed when you install Node, so if you downloaded the node, you may got it

The primary command we use is npm , which means install

for example , to install Grunt (a popular Javascript task runner), you would issue the following command -

npm install -g grunt-cli

the -g flage tells npm to install the package globally

  • globally

it’s available globally on the system, anywhere

this distinction will become clrearer when we cover the package.json files. For now, the rule of thumb is that Javascript utilities (like Grunt) will generally be installed globally. whereas packages that are specific to your web app o project will not

💡 unlike languages like python- which underwent a major language change from 2.0 to 3.0, necessitating a way to easily swithch between different environments. - the node platform is new enough that it is. however, if you do find yourself needing to support multiple- version of node, there is a project, nvm that allows you to switch environments

let’s see the two ways how npm works

  1. local

if i don't choose other specific options, the package will be installed in local.

node_modules directory will be created in project root and the package will be installed in it.

local-installed packages can be only used in specific project

npm install <packagename>
  1. global

if you wanna install package in global way, you can put -g option.

it will install in global ways and it would make you to use that package on everywhere.

npm install -g <packagename>

for more, global-installed pacakage’sdownload place will be different depending on your os.

Mac: usr/local/lib/node_modules

window: c:\Users\%USERNAME%\AppData\Roaming\npm\node_modules

If you install the package in global way, it can be more comfortable to use it. but the fatal thing of this is : their info would not be written at package.json

for this, we can use -D option and install it devdependencies, and run it by npx command.

npm install -D nodemon
npm nodemon <packagename>

if you need some, there’s an analogy for you :


  • Development Team Leader: Controls the work efficiency of the development team and directs work to general employees.
  • Employee: A worker who is very diligent in whatever he is asked to do (?)

[ Scenario 1 ]

  • The development team leader instructs each of the three employees at the same time. ( = asynchronous )
  • Surprisingly, the development team leader doesn't even check what he ordered the 3 employees to do, and does his own work (= asynchronous)
  • Each employee completes the assigned task on their own and reports to the development team leader. ( = non-blocking )

[ Scenario 2 ]

  • The development team leader instructs employee 1 to work.
  • And until the work of employee 1 is over, it gives an eye to when it is over. ( = motive )
  • Employee 1's work is too slow, so he tries to give the job to another employee. ( = asynchronous )
  • However, employee 1 grabs the hem of the development team leader’s clothes asking for help. ( = blocking )
  • Employee 2 and Employee 3 who watch it are willing to work hard no matter what they are given, but there is no work. ( = motive )
728x90
300x250

'2023 공부한것들' 카테고리의 다른 글

[node.js] es? (es5, es6)  (0) 2023.06.18
[node.js] making a simple web server with node  (0) 2023.06.18
[TIL] 20230618 : what's your name?  (0) 2023.06.18
[node.js] console.log function  (0) 2023.06.17
[TIL] 20230617 : killing my ocd  (0) 2023.06.17
728x90
728x90

what's your name?

i'm hired

you're hired?

thanks, sir


TIMELINE


5:00am  
6:00am  
7:00am  
8:00am  
9:00am  
10:00am  
11:00am  
12:00pm  
1:00pm  
2:00pm  
3:00pm  
4:00pm doing some randome quests
5:00pm TIL of yesterday
6:00pm dinner
7:00pm console.log
8:00pm nothing but the best
9:00pm nothing but the best
10:00pm  
11:00pm  
12:00am  
1:00am  
2:00am  
3:00am  
4:00am  
5:00am  

 

what i did was.. almost nothing lol 

not the worst day on my life but only non-satisfied

 

well sometimes doing nothing can be the best way

no plans for today : think i'm in burnout


https://insidepixce.tistory.com/91

 

[node.js] console.log function

most Javascript systems (including node js) provide a console.log function that writes out its arguments to some text output device. In browsers, the output lands in the JavaScript console. The console.log function is a useful tool for debugging and unders

insidepixce.tistory.com

 

i should not keep in personal for everything they told 


only to be humbled and eagered, nothing to be serious. for more, talk empty. that's all i should do 

728x90
300x250

'2023 공부한것들' 카테고리의 다른 글

[node.js] making a simple web server with node  (0) 2023.06.18
[node js] npm  (0) 2023.06.18
[node.js] console.log function  (0) 2023.06.17
[TIL] 20230617 : killing my ocd  (0) 2023.06.17
[node.js] call stack (eng)  (0) 2023.06.17

+ Recent posts