NWJS - "No files matching" 尝试打包应用程序时出错

NWJS - "No files matching" error when trying to package app

我正在尝试按照 YouTube 和网络上的各种教程打包 NWJS 应用程序。但是我收到“没有文件匹配”错误并且它退出了。假设是因为 dist/ 和 src/ 目录没有创建,我自己创建了它们,但我仍然得到错误。 package.json 中列出的所有其他路径都存在。

在网上搜索类似的问题后,我唯一找到的是:

https://github.com/nwutils/nw-builder/issues/190

但是,这是关于使用命令行参数进行构建,而不是从 package.json。

npm和nodejs更新到最新版本,nwjs更新到0.64.0-sdk。

我正在尝试在 MacOS 10.13.6、nodejs 版本 16.15.0、npm 版本 8.5.5 上构建。

有什么想法吗?

谢谢! 凯文

CLI:

15:40:55 : ~/ReolinkNWJS
npm run prod

> ReolinkNWJS@0.0.1 prod
> nwbuild --platforms osx64 --buildDir dist/ src/

No files matching

15:41:00 : ~/ReolinkNWJS
ls
dist            icons            javascript        package-lock.json    package.json.TEMPLATE    src
html            images            node_modules        package.json        resources        styles

package.json:

{
  "name": "ReolinkNWJS",
  "description": "Reolink Client App In NWJS Framework",
  "version": "0.0.1",
  "icon": "icons/app.icns",
  "main": "html/main.html",
  "chromium-args": "--enable-logging=stderr --enable-spell-checking",
  "window": {
    "toolbar": false,
    "width": 800,
    "height": 500,
    "position": "center"
  },
  "nodejs": true,
  "node-remote": "*://*",
  "scripts": {
    "prod": "nwbuild --platforms osx64 --buildDir dist/ src/"
  },
  "devDependencies": {
    "nw": "^0.64.0-sdk",
    "nw-builder": "^3.7.0"
  }
}

我认为您需要删除 src/ 或将其移至前面

  • "prod": "nwbuild --platforms osx64 --buildDir dist/"
  • "prod": "nwbuild src/ --platforms osx64 --buildDir dist/"

此外,删除或更改您的 node-remote。目前设置为互联网上的任何网页都可以完全控制 运行 节点,这意味着他们可以轻松读取计算机上所有文件的内容,下载 virus.exe,删除所有文件,等等,从字面上任何东西。不要那样做。

node-remote 几乎专门用于指向 http://localhost:8080 或某个其他端口,用于您的应用 运行 所在的本地网络服务器。您的 main 指向本地文件,而不是网络服务器,因此您可能根本不需要 node-remote

您可能想将根的 "icon" 移动到 "window" 子对象中。