我可能误解了 postinstall
中的 package.json
事件,但我为其指定的代码并未执行。
我想在我的包中使用 postinstall
,它应该与 React Native 应用程序一起使用,并且依赖于另一个包含本机代码的包 (A)。如果我将 A 指定为我的包的 dependency / peerDependency
,则使用我的包的应用程序将崩溃,因为 A 不会列在此应用程序的 package.json
dependencies / peerDependencies
部分中,因此 A 不会链接。
所以我决定添加
"scripts": {
"postinstall": "npm i A"
}
到我的包裹的 package.json
。但是当我在我的应用程序目录中运行 npm i my_package
时,没有安装 A。我试图从 echo some text
事件中仅 postinstall
,但这也不起作用。
我的 npm 版本是 7.11.1,node 版本是 v15.8.0。