gpt4 book ai didi

node.js - -save-dev 在 npm install grunt --save-dev 中是什么意思

转载 作者:IT老高 更新时间:2023-10-28 21:44:53 26 4
gpt4 key购买 nike

我刚刚开始使用 Grunt.js .设置起来非常困难,我正在创建一个 package.json 文件。

关注 tutorial ,它说有 3 种方法可以创建 package.json 文件。

首先是做npm install grunt --save-dev

但是--save-dev是什么意思呢?我试着找了下,结果却是徒劳。

最佳答案

--save-dev: Package will appear in your devDependencies.

根据npm install docs .

If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the external test or documentation framework that you use.

换句话说,当你运行 npm install 时,你的项目的 devDependencies 将被安装,但你的应用所依赖的任何包的 devDependencies 都不会被安装;此外,将您的应用程序作为依赖项的其他应用程序不需要安装您的 devDependencies。只有在开发应用程序时才需要此类模块(例如 grunt、mocha 等)。

根据package.json docs

编辑:尝试可视化 npm install 的作用:

  • 你的项目
    • 已安装依赖项
      • 已安装依赖项
        • 已安装依赖项
        • 没有安装devDependency
      • 没有安装devDependency
    • 已安装 devDependency
      • 已安装依赖项
      • 没有安装devDependency

关于node.js - -save-dev 在 npm install grunt --save-dev 中是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19223051/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com