Home > Article > Web Front-end > Node.js No-frills npm
Learning points
View version
Upgrade
Install module
Use module
View module list
Uninstall module
Update module
Search module
Create module
Publish module
REPL
npm package Manager
View version
[code]npm -v
npm upgrade
Under windows
[code]npm install npm -glunix under
[code]sudo npm install npm -g /usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js npm@2.14.2 /usr/local/lib/node_modules/npm
Installation Module—express module
[code]npm install express
The installation directory is in the node_modules folder under the current project
Use the module
[code]var express = require('express');View the installed module
[code]npm lsUninstall and install Module
[code]npm unstall expressUpdate module
[code]npm update express
[code]npm search expressCreate module
npm init
Then enter as required until Is this ok? (yes)
Finally generate the package.json file
[code]{ "name": "wolf", // 模块名称 "version": "1.0.0", // 版本号 "description": "海涵狼群俱乐部", // 描述 // main 字段是一个模块ID,它是一个指向你程序的主要项目。 // 就是说,如果你包的名字叫 express,然后用户安装它,然后require("express")。 "main": "index.js", "dependencies": { // 依赖包列表 "express": "^4.14.0" }, "devDependencies": {}, "scripts": { // 测试 "test": "make test", "start": "node server.js" }, "repository": { // github账号 "type": "git", "url": "http://lamport.me/club" }, "author": "zhang", // 作者 "license": "ISC" // 护照 }
Registered user
[code]npm adduserPublish module
[code]npm publish
Exit twice ctrl + c
The above is the content of Node.js unpretentious npm, more For related content, please pay attention to the PHP Chinese website (www.php.cn)!