Grunt.js:在npm install grunt --save-dev中,-save-dev是什么意思 [英] Grunt.js: What does -save-dev mean in npm install grunt --save-dev

查看:128
本文介绍了Grunt.js:在npm install grunt --save-dev中,-save-dev是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用 Grunt.js 。这很难设置,我正在创建 package.json 文件。



关注这个教程,它说有三种方法可以创建 package.json file。



第一个是 npm install grunt --save-dev



但是 - save-dev 意味着什么?我试过看,但它结束了徒劳。

解决方案


- save-dev:出现在你的devDependencies中。


根据 npm install docs


如果有人计划在他们的程序中下载和使用你的模块,那么他们可能不想或者不需要下载和构建您使用的外部测试或文档框架。换句话说,当你运行 npm install 时,你的项目的devDependencies将被安装,但是你的应用依赖的任何软件包的devDependencies将不会被安装;此外,将您的应用程序作为依赖项的其他应用程序不需要安装devDependencies。根据 /json.html#devDependenciesrel =noreferrer> package.json文档



编辑:尝试查看 npm安装确实:




  • 您的项目


    • 已安装的依赖项


      • 安装的依赖项


        • 已安装的依赖项
        • 未安装devDependency


      • 未安装devDependency


    • 安装了devDependency


      • 已安装的依存关系
      • 未安装devDependency



I've just started using Grunt.js. It is pretty hard to set up and I am at the point of creating a package.json file.

Following this tutorial, it says there are 3 ways to create a package.json file.

The first is to do npm install grunt --save-dev

But what does --save-dev means? I tried looking but it ends in vain.

解决方案

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

According to the 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.

In other words, when you run npm install, your project's devDependencies will be installed, but the devDependencies for any packages that your app depends on will not be installed; further, other apps having your app as a dependency need not install your devDependencies. Such modules should only be needed when developing the app (eg grunt, mocha etc).

According to the package.json docs.

Edit: Attempt at visualising what npm install does:

  • yourproject
    • dependency installed
      • dependecy installed
        • dependecy installed
        • devDependency NOT installed
      • devDependency NOT installed
    • devDependency installed
      • dependecy installed
      • devDependency NOT installed

这篇关于Grunt.js:在npm install grunt --save-dev中,-save-dev是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆