2.檢查版本:node -v(node --version)
編寫node程序
? ? ? ? ①var http = require('http'); //引行請(qǐng)求(require)Node.js 自帶的 http 模塊
? ? ? ? ②http.createServer(function (request, response) {?
? ??????????????// 發(fā)送 HTTP 頭部 // HTTP 狀態(tài)值: 200 : OK?
? ??????????????// 內(nèi)容類型: text/plain??
????????????????response.writeHead(200, {'Content-Type': 'text/plain'});?
????????????????// 發(fā)送響應(yīng)數(shù)據(jù) "Hello World"? ??
????????????????response.end('Hello World\n');?
????????????}).listen(8888);??
3.window下npm升級(jí):npm install npm -g
?4.npm 安裝 Node.js 模塊語法格式: npm install 模塊名稱
? ? 安裝模塊時(shí)報(bào)錯(cuò):npm err! Error: connect ECONNREFUSED 127.0.0.1:8087
? ? 解決辦法,設(shè)置代理為null:? npm config set proxy null
? ??npm 的包安裝分為本地安裝(local)谊囚、全局安裝(global)兩種仗扬,從敲的命令行來看裂允,差別只是有沒有-g而已:
????????npm install express # 本地安裝
? ? ? ? npm install express -g # 全局安裝?
5.卸載模塊: npm uninstall 模塊名稱
6.查看安裝模塊:npm ls
7.更新模塊:? npm update 模塊名稱