[Node.js] npm init && npm install
2023-09-14 08:59:21 时间
npm init:
For create package.json file which will recode the dependence.
npm install:
You can also write like:
npm i
This is a shortcut way to write npm install.
For example. we want to install undersocre.js
npm install -S underscore
The way '-S' works is it will write down the dependence into the package.json we just create:
{ "name": "commonJSBroswerfiy", "version": "0.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "MIT", "dependencies": { "underscore": "^1.7.0" } }
dev-dependence:
npm install -D bower
'-D' is to add dependence into devdependence which only available for the co-work.
{ "name": "commonJSBroswerfiy", "version": "0.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "MIT", "dependencies": { "underscore": "^1.7.0" }, "devDependencies": { "bower": "^1.3.12" } }
If we have package.json, other people download our project and they just need to run:
npm i
They can install all the dependence.
相关文章
- js面试题及答案2020_JS面试题大全
- html js 全局 变量,JS定义全局变量
- html如何只刷新页面指定,js控制页面刷新 JS刷新当前页面的几种方法总结
- 初识js中的闭包_Js闭包中变量理解
- Js生成二维码_js在线生成二维码
- 【JDK8 新特性 7】并行的Stream流¶llelStream背后的技术
- JS设置定时器_js设置定时器
- 业务安全之短信&邮箱验证码
- 算法转开发&测开,拿了四个offer(下)
- App Cleaner & Uninstaller for mac(卸载程序和缓存清理助手)
- 7 Papers & Radios | Meta「分割一切」AI模型;从T5到GPT-4盘点大语言模型
- 使用JS连接MySQL数据库:实现化繁为简(js连接mysql数据库)
- Linux上的JS压缩工具(js压缩工具linux)
- 在 React 条件渲染中使用三元表达式和 “&&”
- 利用 JS 实现 Redis 的连接(js连接redis)
- JS实时链接Oracle让数据库访问更便捷(js实时连接oracle)
- Js&Vbs正则表达式替换重复的字符
- JS函数验证总结(方便js客户端输入验证)
- js延迟加载改变JS的位置加快网页加载速度