Javascript 使用一个命令安装所有grunt devdependency

Javascript 使用一个命令安装所有grunt devdependency,javascript,gruntjs,Javascript,Gruntjs,我只需设置Gruntfile.js文件并加载所有(9)个devdependency。为了安装这些devdependency,我使用了以下命令 npm install name-of-plugin --save-dev 我对每个依赖项使用了上述命令9次。现在我想要的是使用一个命令安装所有这些依赖项,比如grunt install plugins或其他命令。该命令将从package.json文件中读取devdependences并为我安装它 这可能吗?如果是,那么如何实现这一点?您必须在packa

我只需设置Gruntfile.js文件并加载所有(9)个devdependency。为了安装这些devdependency,我使用了以下命令

npm install name-of-plugin --save-dev
我对每个依赖项使用了上述命令9次。现在我想要的是使用一个命令安装所有这些依赖项,比如
grunt install plugins
或其他命令。该命令将从package.json文件中读取devdependences并为我安装它


这可能吗?如果是,那么如何实现这一点?

您必须在
package.json和
npm安装中添加
devependencies

package.json

{
  "name": "projectname",
  "version": "0.0.1",
  "dependencies": {},

  "devDependencies": {
        "grunt": "~0.4.1",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-concat": "~0.3.0",
    "grunt-contrib-coffee": "~0.7.0",
    "grunt-contrib-uglify": "~0.2.0",
    "grunt-contrib-compass": "~0.5.0",
    "grunt-contrib-jshint": "~0.6.0",
    "grunt-contrib-cssmin": "~0.6.0",
    "grunt-contrib-connect": "~0.5.0",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-htmlmin": "~0.1.3",
    "grunt-contrib-imagemin": "~0.2.0",
    "grunt-contrib-watch": "~0.5.2",
    "grunt-contrib-jade": "*",
    "grunt-autoprefixer": "~0.2.0",
    "grunt-usemin": "~0.1.11",
    "grunt-svgmin": "~0.2.0",
    "grunt-rev": "~0.1.0",
    "grunt-concurrent": "~0.3.0",
    "load-grunt-tasks": "~0.1.0"
  }
}
然后跑

 npm install

您必须在
package.json
npm安装中添加
devependencies

package.json

{
  "name": "projectname",
  "version": "0.0.1",
  "dependencies": {},

  "devDependencies": {
        "grunt": "~0.4.1",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-concat": "~0.3.0",
    "grunt-contrib-coffee": "~0.7.0",
    "grunt-contrib-uglify": "~0.2.0",
    "grunt-contrib-compass": "~0.5.0",
    "grunt-contrib-jshint": "~0.6.0",
    "grunt-contrib-cssmin": "~0.6.0",
    "grunt-contrib-connect": "~0.5.0",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-htmlmin": "~0.1.3",
    "grunt-contrib-imagemin": "~0.2.0",
    "grunt-contrib-watch": "~0.5.2",
    "grunt-contrib-jade": "*",
    "grunt-autoprefixer": "~0.2.0",
    "grunt-usemin": "~0.1.11",
    "grunt-svgmin": "~0.2.0",
    "grunt-rev": "~0.1.0",
    "grunt-concurrent": "~0.3.0",
    "load-grunt-tasks": "~0.1.0"
  }
}
然后跑

 npm install

如果你知道你的名字,那么你可以这样尝试-

npm install grunt-contrib-sass grunt-contrib-uglify --save

如果你知道你的名字,那么你可以这样尝试-

npm install grunt-contrib-sass grunt-contrib-uglify --save