1.概念
NPM 的全称是 Node Package Manager,是一个 NodeJS 包管理和分发工具。
2.NPM 镜像设置与查看
1 2
| npm config set registry https://registry.taobao.org --global npm config set disturl https://npm.taobao.org/dist --global
|
1 2
| npm config get registry npm config get disturl
|
3.NPM 的使用
1 2 3 4 5 6 7 8 9 10 11 12 13
| npm -v npm install <ModuleName> npm install <ModuleName> -g npm -g install npm@5.9.1 npm uninstall <ModuleName> npm update <ModuleName> npm list -g npm list vue npm install --save <ModuleName> npm install --save-dev <ModuleName>
npm init (--yes/-y) npm install
|
4. package.json 文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| { "name": "npm-demo", "version": "1.0.0", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "HuYe", "license": "ISC",
"dependencies": { "jquery": "^3.6.0"
},
"devDependencies": { "bootstrap": "^5.0.1" } }
|