我是靠谱客的博主 欢呼翅膀,这篇文章主要介绍NodeJS 的 Postinstall,现在分享给大家,希望可以做个参考。

其实基本无需理会 Postinstall,因为默认下 MeanJS 的 Postinstall 是 false

"scripts": {
"start": "grunt",
"test": "grunt test",
"postinstall": "bower install --config.interactive=false"
},

不过要深入 NodeJs 还是了解一下到底 postinstall 到底是什么
比如你有一个这样的代码(Linux 环境下)

#!/usr/bin/env node
console.log('node modules installed!');

存放在这个位置: ./bin/npm-postinstall
这个时候你就可以用 postinstall 来进行安装后的脚本处理

{
"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内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(102)

评论列表共有 0 条评论

立即
投稿
返回
顶部