Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何打包 #101

Open
Aiernory opened this issue Oct 16, 2022 · 1 comment
Open

如何打包 #101

Aiernory opened this issue Oct 16, 2022 · 1 comment
Labels
good first issue Good for newcomers question Further information is requested

Comments

@Aiernory
Copy link

问题描述

我自己改了个东西,加了个系列的分类,然后 用 pkg 打包,启动后报错;百度了好久都没解决
错误信息

版本

  • 系统:Windows11
  • 安装方式:源码打包
  • 版本:基于0.6.2 改了代码,没动配置类的文件

pkg/prelude/bootstrap.js:1876
throw error;
^

Error: Cannot find module './dialects/sqlite3/index.js'
Require stack:

  • C:\snapshot\mywork\node_modules\knex\lib\config-resolver.js
  • C:\snapshot\mywork\node_modules\knex\lib\knex.js
  • C:\snapshot\mywork\node_modules\knex\lib\index.js
  • C:\snapshot\mywork\node_modules\knex\knex.js
  • C:\snapshot\mywork\Other\一键启动的\kikoeru-express-0.6.2\database\knex-migrate.js
  • C:\snapshot\mywork\Other\一键启动的\kikoeru-express-0.6.2\database\init.js
  • C:\snapshot\mywork\Other\一键启动的\kikoeru-express-0.6.2\app.js
  1. If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.

截图

@Aiernory Aiernory added the bug Something isn't working label Oct 16, 2022
@umonaca umonaca added good first issue Good for newcomers question Further information is requested and removed bug Something isn't working labels Oct 25, 2022
@umonaca
Copy link
Collaborator

umonaca commented Oct 25, 2022

这个项目是GitHub Actions自动打包的,步骤在这里.
本地的话你可以按类似的顺序尝试一下:

  1. npm install
  2. npm install -g pkg@4.5.1
  3. 把你之前编译出来的前端放进dist文件夹
  4. pkg package.json -t node14-win-x64 --out-path package
  5. 把后端项目目录下node_modules/sqlite3/lib/binding/napi-v3-win32-x64/node_sqlite3.node复制到上一步用pkg打包出来的文件旁边
    以上步骤的当前工作目录应当确保是项目根目录。然后再试一下能不能用。注意最终应该是一个exe文件一个node_sqlite3.node,二者必须在同一目录下。

@umonaca umonaca changed the title [Bug] 如何打包 Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants