Ankit Saxena
Ankit Saxena

Reputation: 41

how to download and install all node modules through package.json?

I want to invoke and download all node modules through maven, in maven I have defined the plugins to install it but now in my package.json i have defined the following npm install command, please advise how can i install all node modules and can define them in package.json

package.json

{
  "name": "MyProject",
  "version": "1.0.0",
   "author": "Saral",
  "scripts":{
  "start":"node gulpfile.js",
   "prebuild": "npm install",
    "build": "gulp"
    },

  "dependencies": {
    "gulp": "*",
    "gulp-ruby-sass": "*",
    "gulp-util": "*",
    "gulp-rename": "*",
    "gulp-concat": "^2.6.0",
    "gulp-concat-vendor": "0.0.4",
    "map-stream": "*",
    "gulp-livereload": "*",
    "gulp-concat": "*",
    "gulp-uglify": "*",
    "gulp-minify-css" : "^1.2.1",
    "gulp-notify":"2.2.0",
    "gulp-inject": "1.5.0",
    "run-sequence": "1.1.4",
    "stream-series": "0.1.1",
    "gulp-gzip": "1.2.0",
    "gulp-clone": "1.0.0",
    "gulp-watch": "*"


  }
}

Upvotes: 3

Views: 32048

Answers (2)

RiZKiT
RiZKiT

Reputation: 2511

As I understand the question, just use the "Frontend Maven Plugin"

  1. It installs node & npm: https://github.com/eirslett/frontend-maven-plugin#installing-node-and-npm
  2. Executes npm install, which is already the default argument and can be omitted: https://github.com/eirslett/frontend-maven-plugin#running-npm

Upvotes: 0

Aswin
Aswin

Reputation: 349

Go to your terminal and type in

npm install 

This will crawl through all the required packages mentioned in package.json and download it to node_modules folder.

When using gulp in your gulpfile.js

var install = require("gulp-install");

gulp.src(['./bower.json', './package.json'])
.pipe(install());

So when you run gulp in your terminal all the packages in bower.json and package.json will be downloaded into bower_components and node_modules, respectively.

Upvotes: 10

Related Questions