Search code examples
nwjs

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


I'm trying to package an NWJS app following various tutorials on YouTube and the web. But I'm getting "No files matching" error and it exits. Assuming it was because the dist/ and src/ directories hadn't been created, I created them myself, but I still get the error. All other paths listed in package.json exist.

After searching the web for a similar issue, the only thing I found was this:

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

However, this is regarding doing the build using command line args, rather than from package.json.

npm and nodejs were updated to latest version and nwjs was updated to 0.64.0-sdk.

I am attempting the build on MacOS 10.13.6, nodejs version 16.15.0, npm version 8.5.5 .

Any ideas anyone?

Thanks! Kevin

CLI:

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

> [email protected] 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"
  }
}

Solution

  • I think you either need to remove your src/ or move it to the front

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

    Also, either remove or change your node-remote. It is currently set up so that any webpage on the internet has complete control to run Node, meaning they can easily read the contents of all files on the computer, download virus.exe, delete all files, whatever, literally anything. Don't do that.

    node-remote is almost exclusively used to point to http://localhost:8080, or some other port, for a local webserver your app runs on. Your main is pointing to a local file, not a webserver, so you likely do not need node-remote at all.

    You probably want to move the "icon" at the root into the "window" sub object.