npm package manager

npm init (this will generate a package.json)

 

Install packages locally

1. see 'import express from 'express'; => 

npm install express

(node modules folder is created, regular dependence included in the project)

2.add dependency that is used throughout the development but not included in the production build  =>

 npm install babel-cli babel-preset-stage-0 babel-preset-es2015 --save-dev

 

install packages globally

install globally in C:\Program Files\nodejs\node_modules\npm?

install react globally => npm install -g react (sudo npm install react -g)

install the CLI tool to create application with react => sudo npm install create-react-app -g

 

update packages

sudo npm install eslint@5.2.0 -g  (install a package of a particular version)

npm outdated (check dependency only LOCALLY)

npm outdated -g (check dependency only GLOBALLY)

sudo npm install eslint -g

 

removing a package

npm uninstall babel-preset-es2015 

npm instal babel-preset-env --save-dev

 

sematic versioning

1.4.2 means:

1 is major releases

4 is for minor releases

2 is for patch releases

^1.15.4 means:

caret for all minor and patches OK

~1.5.4 means:

tilde for all patches only

 

package.json

package.json is input and package-lock.json is output

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值