A collection of common commands for node and npm

The input npm command on cmd is stuck, the possible reason is that the npmrc file path is configured incorrectly

npm command

1.

View configuration results

npm config ls

2. Check node and npm versions

node -v

npm -v

tsc -vcheck typescript version number

3. Install typescript

npm install  typescript -g

4. Install Angular-cli 

npm install  @angular/cli -g

5. Install cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org



angular command


1. Create a project 

ng new my-angular2-app 

2. Start the project 

Go to the project directory you just created, i.e. ./my-angular2-app 

ng serve

ng serve --open

--open 标志会打开浏览器,并访问 http://localhost:4200/

3.创建名为heroes的新组件

ng generate component heroes



vue命令

安装vue脚手架

npm install vue-cli -g

# 创建一个基于 webpack模板的新项目
$ vue init webpack my-project
# 安装依赖,走你
$
cd my-project
$ npm install
$ npm run dev




Install less and compile less:

Install:

npm install less –g 

Compile:

lessc example/example.less example/example.css


Install node-sass to compile sass

Install:

npm install node-sass -g

Compile:

node-sass input.scss output.css

Monitor:

node-sass --watch input.scss output.css

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325533576&siteId=291194637