2

How to use nwjc, Tried to use it from command line from the project path, but getting nwjc: command not found.

Do I need to download anything more than nwbuilder and nw for using nwjc?

5 Answers 5

1

You need to download the SDK version of Node Webkit

nwjs-sdk-v0.21.5-win-x64.zip

This contains the nwjc.exe you need to use snapshot command.

Hope this helps

1

First of all, you must ensure that you install the SDK version of nwjs because the nwjc command line is available in the same folder. You must install the last version of the nwjs SDK version with the following command.

npm install nw --nwjs_build_type=sdk -g

Then, it would be better to find the global npm folder on your computer.

On a macOs, the path to nwjc is /usr/local/npm_packages/lib/node_modules/nw/nwjs/nwjc

On a pc it should be c:\users\yourusername\AppData\Roaming\npm\node_modules\nw\nwjs\nwjc

In the folder where you have the js file to turn into bin, you can do on a PC:

c:\users\yourusername\AppData\Roaming\npm\node_modules\nw\nwjs\nwjc file.js file.bin

Keep in mind that you must use nwjc on a mac for .bin distribution on a mac and nwjc on a PC for .bin distribution on Ms windows.

Why I didn't not talk about environment variables? After adding environment variables and running ">nwjc file.js file.bin", nwjc requires two additional system files to be located in the folder of file.js. I think it is native_blob.bin and another one named v8_context_snapshot.bin. Those two files are located in the root folder of nwjc in the system (see system path above depending on the OS). Without copying those two files, you will get an error.

Consequently, you must copy those two files manually in every folder where there is a .js file to convert into .bin when you use the command "nwjc" without the full path. On the other hand, if you use the full nwjc path, you don't need to copy the files.

0

http://docs.nwjs.io/en/latest/For%20Users/Advanced/Protect%20JavaScript%20Source%20Code/

Compile:

nwjc source.js binary.bin

Load:

nw.Window.get().evalNWBin(frame, 'binary.bin');
0
nwjc

nwjc compiler is part of nw.js sdk

in order to get nwjc you need to install sdk version with :

npm install -g [email protected]

installing global may require sudo permission.

one more thing sometime if nwjc command not found you need to add nwjc binary to your environment path.

For mac os add this to your .base_profile file

export PATH=/usr/local/lib/node_modules/nw/nwjs:$PATH

and do source ~/.bash_profile

0

For the records, the command for adding NWJC to your bash profile works the same on linux too.

export PATH=/usr/local/lib/node_modules/nw/nwjs:$PATH

Just try it, it worked for me.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.