我想通过maven调用和下载所有节点模块,在maven中我已经定义了插件来安装它但现在在我的package.json中我定义了以下npm install命令,请指教我如何安装所有节点模块并可以在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": "*"
}
}
答案 0 :(得分:4)
转到您的终端并输入
npm install
这将遍历package.json中提到的所有必需软件包,并将其下载到node_modules文件夹。
在gulpfile.js中使用gulp
var install = require("gulp-install");
gulp.src(['./bower.json', './package.json'])
.pipe(install());
因此,当您在终端中运行gulp时,bower.json和package.json中的所有软件包将分别下载到bower_components和node_modules中。
答案 1 :(得分:0)
据我了解的问题,只需使用“ Frontend Maven Plugin”
npm install
,它已经是默认参数,可以省略:https://github.com/eirslett/frontend-maven-plugin#running-npm