其实基本无需理会 Postinstall,因为默认下 MeanJS 的 Postinstall 是 false
复制代码
1
2
3
4
5
6"scripts": { "start": "grunt", "test": "grunt test", "postinstall": "bower install --config.interactive=false" },
不过要深入 NodeJs 还是了解一下到底 postinstall 到底是什么
比如你有一个这样的代码(Linux 环境下)
复制代码
1
2
3#!/usr/bin/env node console.log('node modules installed!');
存放在这个位置: ./bin/npm-postinstall
这个时候你就可以用 postinstall 来进行安装后的脚本处理
复制代码
1
2
3
4
5
6
7
8
9
10
11{ "name": "some-app", "version": "0.0.1", "authors": [ "George Ornbo <george@shapeshed.com>", ], "scripts": { "postinstall": "node bin/npm-postinstall" } }
附: package.json 是什么
以上的代码都是 package.json 文件的内容,package.json 是用来安装部署环境的配置文件,npm install
就是读取该文件来完成自动安装的。
转载于:https://my.oschina.net/wjlin/blog/513594
最后
以上就是欢呼翅膀最近收集整理的关于NodeJS 的 Postinstall的全部内容,更多相关NodeJS内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复