跨平台安装npm软件包sqlite3
问题说明
是否有一种方法可以为我要在我的应用中定位的多个平台安装 node-sqlite3
,而不必为每个目标平台组合都运行独立的构建?
Is there a way to install node-sqlite3
for multiple platforms I am targeting in my app without running standalone build for just every target platform combination?
在我的Node.js应用中,我有一个npm依赖项 node-sqlite3
(GitHub , npm ),其中包含适用于不同平台的不同二进制文件(绑定).
In my Node.js app I have a npm dependency node-sqlite3
(GitHub, npm), which contains different binaries (bindings) for different platforms.
我的应用程序针对不同的平台,包括 Windows , Linux 和 macOS ( ia32 和 x64 )和现代节点版本:v6,v7和v8.该应用没有任何特定于平台的行为.
My app is targeting different platforms, including Windows, Linux and macOS (both ia32 and x64) and modern Node versions: v6, v7 and v8. The app doesn't have any platform-specific behavior.
如果我使用 npm install
安装项目的依赖项,则 node-sqlite3
下载仅适用于当前平台的二进制文件(假设 win32
, x64
, Node v7.10
).
If I install the project's dependencies using npm install
, node-sqlite3
downloads binaries just for the current platform (let's say win32
, x64
, Node v7.10
).
我还有一个Travis CI构建配置,可用于持续部署和持续集成.我选择 Ubuntu Trusty 作为执行构建的主机.
I also have a Travis CI build configuration, which I use for Continuous Deployment as well as Continuous Integration. I chose Ubuntu Trusty as a host for executing builds.
作为构建过程的一部分,通过 npm install
安装应用程序的依赖项.在部署过程中,将打包(存档)具有依赖性的已构建应用程序,并将其上载到文件托管中,以进行进一步分发.
As a part of a build process the app's dependencies are being installed by npm install
. Within deployment process, the built app with it's dependencies is being packaged (archived) and uploaded to a file hosting for further distribution.
node-sqlite3
并未针对我需要的所有目标平台安装,而仅针对当前正在使用的平台(用于开发或执行构建)安装.
node-sqlite3
is not installed for all target platforms I need, but just for a platform currently being used (for development or executing a build).
我可以执行构建并部署:
I could execute builds and deploy:
- 使用Travis-适用于Linux和macOS
- 使用AppVeyor-Windows版
但是,这似乎是一个很大的开销.正如我已经说过的,该应用程序没有任何特定于平台的行为.而且我相信 node-sqlite3
的供应商已经在我定位的所有主要平台上对其进行了测试.
But that's looks like a big overhead. As I've already said, the app doesn't have any platform-specific behavior. And I trust node-sqlite3
's vendor tested it at all major platforms I am targeting.
正确答案
是,如果使用 node-sqlite3
,您确实具有这样的功能.
Yes, in case with node-sqlite3
you do have such a capability.
可能是因为它的所有者 mapbox 使用 node-pre-gyp
( GitHub , node-pre-gyp文档中的选项说明.
-目录:在此目录中运行命令
-target_platform = win32 :传递目标平台并覆盖主机平台.有效值为linux,darwin,win32,sunos,freebsd,openbsd和aix.
--target_platform=win32: Pass the target platform and override the host platform. Valid values are linux, darwin, win32, sunos, freebsd, openbsd, and aix.
-target_arch = ia32 :传递目标拱门并覆盖主机拱门.有效值为'ia32','x64'或arm.
--target_arch=ia32: Pass the target arch and override the host arch. Valid values are 'ia32','x64', or arm.
-target = 0.10.25 :传递目标节点或node-webkit版本进行编译
--target=0.10.25: Pass the target node or node-webkit version to compile against
如果存在,则将从文件存储(Amazon S3)中下载用于所选平台的预构建二进制文件.否则,您必须自己构建二进制文件.
If they exist, prebuilt binaries for chosen platform will be downloaded from a file storage (Amazon S3). Otherwise you have to build binaries by yourself.
node-sqlite3
的可用二进制文件列表为查看全文
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfiheg
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20