当前位置:网站首页>npm install --save 和 npm install --save-dev区别
npm install --save 和 npm install --save-dev区别
2022-04-22 14:16:00 【博客zhu虎康】
npm install moduleName //安装模块到项目目录下
npm install -g moduleName // -g 的意思是将模块安装到全局,具体安装到磁盘哪个位置,要看 npm config prefix 的位置。
npm install -save moduleName // -save 的意思是将模块安装到项目目录下,并在package文件的dependencies节点写入依赖。
npm install -save-dev moduleName //-save-dev 的意思是将模块安装到项目目录下,并在package文件的devDependencies节点写入依赖。
-
npm install moduleName 命令
- 安装模块到项目node_modules目录下。
- 不会将模块依赖写入devDependencies或dependencies 节点。
- 运行 npm install 初始化项目时不会下载模块。
- npm install -g moduleName 命令
-
安装模块到全局,不会在项目node_modules目录中保存模块包。
- 不会将模块依赖写入devDependencies或dependencies 节点。
- 运行 npm install 初始化项目时不会下载模块。
- npm install -save moduleName 命令
-
安装模块到项目node_modules目录下。
- 会将模块依赖写入dependencies 节点。
- 运行 npm install 初始化项目时,会将模块下载到项目目录下。
- 运行npm install --production或者注明NODE_ENV变量值为production时, - 会自动下载模块到node_modules目录中。
-
npm install -save-dev moduleName 命令
- 安装模块到项目node_modules目录下。
- 会将模块依赖写入devDependencies 节点。
- 运行 npm install 初始化项目时,会将模块下载到项目目录下。
- 运行npm install --production或者注明NODE_ENV变量值为production时,不会自动下载模块到node_modules目录中。
总结
devDependencies 节点下的模块是我们在开发时需要用的,比如项目中使用的 gulp ,压缩css、js的模块。这些模块在我们的项目部署后是不需要的,所以我们可以使用 -save-dev 的形式安装。像 express 这些模块是项目运行必备的,应该安装在 dependencies 节点下,所以我们应该使用 -save 的形式安装。
版权声明
本文为[博客zhu虎康]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_53810245/article/details/124333423
边栏推荐
- 深入理解读写锁ReentrantReadWriteLock和并发容器CopyOnWriteArrayList
- Markdown Icon
- Detailed explanation of channel implementation of cocoyaxi Library
- 万元礼品奖池!玩转「Lighthouse」有奖征文来袭
- Development environment of expert system
- Binary Tree递归||二叉树展开为链表 530. 二叉搜索树的最小绝对差
- MapReduce高级应用——全排序和二次排序
- 2022 examination questions and simulation examination of operation certificate for safety management personnel of hazardous chemical business units
- logcat的使用
- Operation of 2022 chemical automation control instrument examination practice question simulation examination platform
猜你喜欢

Fastdfs installation and configuration

uniapp运行到微信开发者工具中小程序端页面空白的解决办法

万元礼品奖池!玩转「Lighthouse」有奖征文来袭
![uniapp转微信开发者工具报错 - [ app.json 文件内容错误] app.json: 未找到 [“sitemapLocation“] 对应的 sitemap.json 文件](/img/3b/2f371eab7d2f9e976dcd4612a19518.png)
uniapp转微信开发者工具报错 - [ app.json 文件内容错误] app.json: 未找到 [“sitemapLocation“] 对应的 sitemap.json 文件

Wonderful linkage! Principle and practice of openmldb pulsar connector

An error is reported when reading the attribute value of the object through the variable storage key value in TS (TS: 7053)

链表 环形链表 链表判环 寻找入环节点141、142

【终于等到你】微信转发语音的方法 - 语音信息转发

多线程进阶

深入剖析volatile原理
随机推荐
TopK
An error is reported when reading the attribute value of the object through the variable storage key value in TS (TS: 7053)
BitMap BloomFilter BitSet详解
线程池--
Actual combat of wechat applet mall project (Part 6: commodity search)
translucentTB汉化界面 - 菜单汉化 - 怎么使用 - win11任务栏透明效果
uniapp转微信开发者工具报错 - [ app.json 文件内容错误] app.json: 未找到 [“sitemapLocation“] 对应的 sitemap.json 文件
[robot learning] learning record of mobile robot odometer
leetcode:215. 数组中的第K个最大元素
plsql developer文件编码格式设置
Shiro之缓存管理
华为云媒体査勇:华为云在视频AI转码领域的技术实践
Solve command line is too long Shorten command line for........ error
ipv6相关
2022 tea artist (intermediate) examination simulation 100 questions and simulation examination
Tools applicable to any database - Shanghai daoning brings a powerful general database management tool dbeaver to developers and database administrators
Where do embedded software bugs come from and how do they go
2022危险化学品经营单位安全管理人员操作证考试题及模拟考试
shell入门使用
[zeekr_tech] Introduction to ros/ros 2