1. 程式人生 > 其它 >jsp Java服務端頁面

jsp Java服務端頁面

安裝

安裝

解壓到某個目錄,如:D:\Documents\node

設定環境變數

新建系統變數:
NODE_HOME
D:\Documents\node
NODE_PATH
%NODE_HOME%\node_modules
在Path中新增:
%NODE_HOME%


操作

npm包管理器

# 安裝模組
npm install (with no args, in package dir)
npm install [<@scope>/]<name>
npm install [<@scope>/]<name>@<tag>
npm install [<@scope>/]<name>@<version>
npm install [<@scope>/]<name>@<version range>
npm install <tarball file>
npm install <tarball url>
npm install <folder>

選項:[-S|--save|-D|--save-dev|-O|--save-optional] [-E|--save-exact] [--dry-run]
-S, --save 安裝包資訊將加入到dependencies(生產階段的依賴)
-D, --save-dev 安裝包資訊將加入到devDependencies(開發階段的依賴),所以開發階段一般使用它
-O, --save-optional 安裝包資訊將加入到optionalDependencies(可選階段的依賴)
-E, --save-exact 精確安裝指定模組版本
-f, --force 強制安裝

npm install命令可以根據dependencies配置安裝所有的依賴包
全域性安裝:npm install <pkg> -g

# 解除安裝模組
npm uninstall <pkg>

# 更新模組
npm update [-g] [<pkg>...]

# 檢查模組是否已經過時
npm outdated [[<@scope>/]<pkg> ...]

# 檢視安裝的模組
npm ls [[<@scope>/]<pkg> ...]

# 在專案中引導建立一個package.json檔案
npm init [-f|--force|-y|--yes]

# 檢視包的安裝路徑
npm root [-g]

# 管理npm的配置路徑
npm config set <key> <value> [-g|--global]
npm config get <key>
npm config delete <key>
npm config list
npm config edit
npm get <key>
npm set <key> <value> [-g|--global]

# 管理模組的快取
npm cache add <tarball file>
npm cache add <folder>
npm cache add <tarball url>
npm cache add <name>@<version>
npm cache ls [<path>]
npm cache clean [<path>]

# 啟動、停止、重啟、測試模組
npm start [-- <args>]
npm stop [-- <args>]
npm restart [-- <args>]
npm test [-- <args>]

# 檢視模組版本
npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]

# 檢視模組的註冊資訊
npm view [<@scope>/]<name>[@<version>] [<field>[.<subfield>]...]

# 使用者登入
npm adduser [--registry=url] [--scope=@orgname] [--always-auth]

# 釋出模組
npm publish [<tarball>|<folder>] [--tag <tag>] [--access <public|restricted>]

# 在釋出的包上設定訪問級別
npm access public [<package>]
npm access restricted [<package>]
npm access grant <read-only|read-write> <scope:team> [<package>]
npm access revoke <scope:team> [<package>]
npm access ls-packages [<user>|<scope>|<scope:team>]
npm access ls-collaborators [<package> [<user>]]
npm access edit [<package>]

# 檢視幫助 
npm help <term> [<terms..>]

nrm源管理器

# 安裝
npm install -g nrm

# 列出源
nrm ls

# 切換到源
nrm use <resource>

# 增加源
nrm add <registry> <url> [home]

# 刪除源
nrm del <registry>

# 測試源
nrm test <resource>

# 直接設定源
npm config set registry https://registry.npm.taobao.org

npm配置

# 代理
npm config set proxy=http://server:port
npm config set https-proxy http://server:port
npm config set proxy http://username:password@server:port
npm confit set https-proxy http://username:password@server:port
npm config delete proxy
npm config delete https-proxy

npm install --global --production windows-build-tools
npm install --global node-gyp

更新

npm install -g npm-check
npm-check -u

pm2

# 安裝
npm install -g pm2

# 啟動程序/應用
pm2 start bin/www 或 pm2 start app.js

# 重新命名程序/應用
pm2 start app.js --name wb123

# 新增程序/應用
watch  pm2 start bin/www --watch

# 結束程序/應用
pm2 stop www

# 結束所有程序/應用
pm2 stop all

# 刪除程序/應用
pm2 delete www

# 刪除所有程序/應用
pm2 delete all

# 列出所有程序/應用
pm2 list

# 檢視某個程序/應用具體情況
pm2 describe www

# 檢視程序/應用的資源消耗情況
pm2 monit

# 檢視pm2的日誌
pm2 logs

# 檢視某個程序/應用的日誌
pm2 logs www

# 重新啟動程序/應用
pm2 restart www

# 重新啟動所有程序/應用
pm2 restart all

pm2 start npm -- start