Ank*_*ena 2 node.js npm package.json
我想通过 maven 调用和下载所有节点模块,在 maven 中我已经定义了插件来安装它但是现在在我的 package.json 中我已经定义了以下 npm install 命令,请告知我如何安装所有节点模块并可以定义它们在 package.json 中
包.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": "*"
}
}
Run Code Online (Sandbox Code Playgroud)
转到您的终端并输入
npm install
Run Code Online (Sandbox Code Playgroud)
这将抓取 package.json 中提到的所有必需包并将其下载到 node_modules 文件夹。
在 gulpfile.js 中使用 gulp 时
var install = require("gulp-install");
gulp.src(['./bower.json', './package.json'])
.pipe(install());
Run Code Online (Sandbox Code Playgroud)
因此,当您在终端中运行 gulp 时,所有 bower.json 和 package.json 中的包将分别下载到 bower_components 和 node_modules 中。
| 归档时间: |
|
| 查看次数: |
16282 次 |
| 最近记录: |