简体   繁体   English

如何使用 zeit/pkg 正确打包我的 express 应用程序资产和脚本

[英]How can I package my express app assets and scripts properly with zeit/pkg

I'm trying to package my express app with pkg on Windows 10.我正在尝试在 Windows 10 上使用 pkg 打包我的 express 应用程序。

When I package the app like so:当我像这样打包应用程序时:

pkg package.json -t node10-latest-win-x64 -o webapp-win

the executable in the app directory works fine. app 目录中的可执行文件工作正常。

But I want to ship the app without my sources and configurations.但我想在没有我的来源和配置的情况下发布应用程序。 Therefor my package.json looks like the following:因此,我的 package.json 如下所示:

"pkg": {
     "scripts": [
      "config/config.js",
      "require.js",
      "controllers/**/*.js",
      "migrations/**/*.js",
      "models/**/*.js",
      "routes/**/*.js",
      "public/javascript/**/*.js"
    ],
    "assets": [
      "views/**/*",
      "public/assets/css/**/*.css",
      "public/assets/webfonts/**/*",
      "public/images/**/*.ico",
      "public/stylesheets/**/*.css",
      ".sequelizerc",
      "bin/**/*",
      "config/config.json"
    ]

The packaging again works fine and the executable works in the app directory.打包再次正常工作,可执行文件在 app 目录中工作。 But when I trie to use it without say the config directory or the views directory it fails.但是当我尝试使用它而不说 config 目录或 views 目录时,它失败了。

When I attach the --debug flag to the packaging it says: [debug] Stat info of %1 is added to queue and [debug] Content of %1 is added to queue for every file defined in the assets and scripts.当我将 --debug 标志附加到包装上时,它说: [debug] Stat info of %1 is added to queue[debug] Content of %1 is added to queue在资产和脚本中定义的每个文件的[debug] Content of %1 is added to queue中。 I'm not sure what that means.我不确定这意味着什么。

I'd be greatefull for every help I can get.对于我能得到的每一个帮助,我都会很高兴。 I am really stuck.我真的被困住了。 Thanks谢谢

只需添加--config package.json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Zeit pkg从Express + React应用程序创建单个二进制文件? - Create single binary from express + react app with zeit pkg? 如何使用zeit / pkg npm软件包将NodeJs项目打包为可执行文件? - How to package NodeJs project into an executable with zeit/pkg npm package? zeit / pkg如何捆绑我的节点应用程序? - How does zeit/pkg bundle my node application? 为什么用 Zeit pkg 打包后我的 NodeJS 应用程序在 Linux mint cinnamon 19.1 中作为后台进程运行 - Why my NodeJS app after packing with Zeit pkg is running as a background process in Linux mint cinnamon 19.1 有没有办法让 Express 应用程序与 pkg 资产中不包含的 pkg 参考本地文件打包在一起? - Is there a way to have an Express app packaged with pkg reference local files not included in the pkg assets? 如何正确构造NodeJS,Express和MongoDB代码? - How can I properly structure my NodeJS, Express, and MongoDB code? 如何使用Node / Express服务我的Web应用程序? - How can I serve my web app with Node/Express? 如何在我的 node/express 应用程序中添加事件侦听器? - How can I addEvent listeners in my node/express app? 如何在 express.js 资产上设置响应 header - How can I set response header on express.js assets 如何自动缩小 express js 资产? - How can I automatically minify express js assets?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM