问题标签 [zeit-pkg]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
3166 浏览

node.js - How to package sqlite3 in node.js executable packages?

I want to make use of a simple database in a compiled node.js app. Is this possible without installing the database separately? i.e I want the database to be included in the .exe file so that I can just copy and execute that file.

I'm using pkg to create .exe files and it works well, but when I use the sqlite3 npm module the .exe errors when I try to execute with the following warning:

Which looks similar to a sqlite3 bug that was fixed here: https://github.com/zeit/pkg/issues/183 (since the bug was fixed I assume this is a user issue)

Looking at the error message, it looks like the ...../bide_sqlit3.node file can't be found. And looking at node_modules/ in my development env (where the module works) I can't find that file. So I assume that the file is NOT being included in the executable and that I need to do something that:

  1. Makes pkg include the file in the binary
  2. Alters the path to the file to be the path to the file in the binary

How do I do this with zeit/pkg? or, if this is more correct: How do I force npm to to install binaries to node_modules and then reference those binaries?

0 投票
1 回答
6149 浏览

hosting - 现在不被识别为内部或外部命令 - 尝试使用 Zeit 托管页面时

问候。我正在尝试使用 Zeit 主持一个项目,但我收到一个错误,我不知道如何解决。错误是说 now 不是内部或外部命令,但它似乎出现在我的 package.json 中。我不知道如何补救这种情况。你有什么建议吗?

错误是:

0 投票
1 回答
402 浏览

javascript - Meteor-Now 部署错误“sh:meteor:未找到”

我在使用流星-now 部署我的流星应用程序时遇到问题。我在这里遵循了本教程。我也尝试使用ZEIT 的OSX 客户端进行部署,但它总是抛出同样的错误。
有谁知道解决方法?

此处显示的构建错误


编辑 1:这是我的 package.json

0 投票
0 回答
310 浏览

node.js - 调试由 zeit/pkg 打包的正在运行的 exe 应用程序

我可以将调试器附加到由pkg打包的正在运行的 NodeJS 应用程序吗?我的新公司有一个没有源代码的打包控制台应用程序。它在去年运行良好,但今年有一些小例外。似乎发生了一些异常,因为旧开发人员没有覆盖或硬编码 year 变量。提到的所有异常 c:\snapshot\xxx.js。

我想我们有一个解决方案来恢复他们的文件并对其进行调试。有人帮我找一个调试器,或者恢复源代码吗?我可以通过 IDA 或 ollydbg 修复它吗?

谢谢

0 投票
1 回答
642 浏览

node.js - 将 node.js 应用程序打包为跨平台可执行文件,不适用于桌面应用程序

关于这个主题有很多问题,但它们似乎无法区分桌面应用程序或服务器端应用程序的可执行文件。我想我的第一个问题是:有什么区别?例如,Zeit/pkg 说它们是“node.js 二进制编译器”,而 nwjs(以前称为 node-webkit)说它们是“基于 Chromium 和 node.js 的应用程序运行时”。

我尝试了 zeit/pkg 并且效果很好,但是已经读到除非配置正确,否则可能会出现性能问题。我想确保我选择了正确的工具并且遇到了 nwjs。它似乎做了很多与 pkg 相同的事情,但拥有更多的追随者,以及更多的文档和强大的 api。我可以像使用 pkg 一样使用 nwjs 作为服务器端可执行文件(即不使用桌面功能)吗?

这个答案表明nwjs“是一个选项,但它确实没有设置为执行服务器 - 客户端类型关系”,但随后评论说“您可以以启动方式从node-webkit启动服务器它在 Node.js 中。只是 node-webkit 提供了 B/S 架构之外的另一种方式”。

那么,nwjs 与 pkg 实际上是相同的,还是根本不同?

我意识到还有 Electron,它声明“构建跨平台桌面应用程序”并且看起来类似于 nwjs。我不是想进入 Electron 与 nwjs 的辩论,而是桌面与服务器,如果有区别的话。

0 投票
0 回答
1266 浏览

javascript - 逆向工程使用 zeit/pkg 来“编译”它的节点应用程序

我有一个使用Zeit 的 PKG编译/打包的应用程序(我相信其中有恶意软件,但我希望在继续使用之前确认)。

似乎使用 v8 的快照功能来混淆代码......有什么办法可以扭转这种情况?我知道它在 exe 中编译了节点,但我是编程和逆向工程的新手。

我从哪里开始对这件事进行逆向工程?谢谢!

0 投票
2 回答
8926 浏览

node.js - Node js - 如何使用 pkg 创建可执行文件

我正在尝试executable在我的 node.js 项目中创建一个,pkg我可以创建它但没有 css 文件。

所以,我pkg用安装npm install -g pkg,在package.json我添加这个:

它可以很好地添加 js.files 并识别视图,但 css 文件除外。

我的项目结构是:

  • 上市
    • css
      • 应用程序.css
    • js
      • 应用程序.js
    • 图片
  • 意见

在控制台中,我运行了命令pkg .,它会生成 linux、macos 和 win 可执行文件。

如何也添加我的 css 文件和图像文件夹?

0 投票
1 回答
1819 浏览

node.js - 使使用 zeit-pkg 打包的节点脚本知道完整的文件系统

我有一个节点脚本,它使用模块使用命令行参数commander

我想用 打包它pkg,但我遇到了一些麻烦。

通常我会执行我的脚本:

但 file 参数可以指向用户文件系统中的任何文件夹。

我已经研究过为in配置assetsandscripts属性,但看起来您需要在其中指定一个文件夹,例如:pkgpackage.json

如何让 zeit-pkg 打包节点脚本知道文件系统中的任何可能位置?

我只是用 构建pkg package.json,因为在package.json我有条目:

0 投票
2 回答
1559 浏览

node.js - Zeit/pkg:找不到模块“配置”

我把这个问题提炼成一个简单的测试。我正在使用节点“config”模块为我的应用程序定义配置值。Pkg 不会抱怨构建,但会在运行时显示以下消息。我错过了什么吗?

index.js 很简单:

我在本地“config”目录中有一个 default.json:

我的 package.json,值得:

0 投票
1 回答
607 浏览

node.js - 使用 zeit pkg 从 express + react 应用程序创建单个二进制文件?

如何使用 zeit 将 express + react 文件夹结构打包成单个二进制文件?我可以像这样运行它们中的每一个: node server.js npm run start client

我可以像这样开始: package.json 中的脚本元素:“myapp”:“concurrently --kill-others \"node server\" \"npm run --prefix client start\"",

然后 - npm 在与 package.json 相同的文件夹中运行 myapp。

我想要实现的是以某种方式应用 zeit/pkg,这样我就有一个可以运行的二进制文件,它以与 npm run myapp 相同的方式启动两个服务器。

谁知道怎么做?