nwutils/nw-builder

Cant use nwbuild

nosleepfortonight opened this issue · 4 comments

Issue Type

  • Bug Report
  • Feature Request
  • Other

Current/Missing Behaviour

It doesnt work, just gives an error

fs.js:44
} = primordials;
    ^

ReferenceError: primordials is not defined
    at fs.js:44:5
    at req_ (/usr/lib/node_modules/node-webkit-builder/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/usr/lib/node_modules/node-webkit-builder/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/usr/lib/node_modules/node-webkit-builder/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)

Node.js v20.12.2

Expected/Proposed Behaviour

I wanted to build executable for linux

Additional Info

  • Package version: 1.0.13
  • Operating System: ArchLinux
  • Node version: v20.12.2
  • NW.js version: 0.86.0-2
  • Repro link:
  • ...

(Im not very good at English, and i dont open issues at github oftenly, and sorry if im not mentioned something important)

primordials is a feature that was built in to very old versions of Node.js. You should either use a tool like Volta to manage your Node version, so you can switch to an old version of Node.js. Or you should update to a newer version of nw-builder. You are on version 1.0.13 (9 years old), the latest is 4.7.1 (2 weeks old).

npm uninstall node-webkit-builder

npm install --save-dev nw-builder@latest

Then look at the documentation for how to use the latest version.

primordials is a feature that was built in to very old versions of Node.js. You should either use a tool like Volta to manage your Node version, so you can switch to an old version of Node.js. Or you should update to a newer version of nw-builder. You are on version 1.0.13 (9 years old), the latest is 4.7.1 (2 weeks old).

* https://github.com/nwutils/nw-builder/releases

npm uninstall node-webkit-builder

npm install --save-dev nw-builder@latest

Then look at the documentation for how to use the latest version.

i did what you said and i got this

Error: package.json not found in srcDir file glob patterns.
    at Object.getNodeManifest (file:///usr/local/lib/node_modules/nw-builder/src/util.js:163:11)
    at async nwbuild (file:///usr/local/lib/node_modules/nw-builder/src/index.js:51:16)
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: package.json not found in srcDir file glob patterns.
    at Object.getNodeManifest (file:///usr/local/lib/node_modules/nw-builder/src/util.js:163:11)
    at async nwbuild (file:///usr/local/lib/node_modules/nw-builder/src/index.js:51:16)

Node.js v20.12.2

You'll have to post a link to your project, the error is related to your project files

Without knowing the specifics you have two options:

  1. Disable globbing if your srcDir is just one dir and your package.json is under srcDir for eg (./nwapp/package.json)
nwbuild({
  glob: false
});
  1. Pass the file path to your NW.js manifest before other files:
nwbuild({
  srcDir: './package.json ./nwapp/**'
})