Closed evshiron closed 8 years ago
Not good. It doesn't work in node.js 0.10/0.11, either. Maybe I should seek for another approach?
The tests passed and the built executables worked with node.js 0.10.44/0.11.16/4.0.0 on Windows. And when I went to test again on Mac OS X, the built executables also worked on Windows. WTF?
I don't know if it's related, but I am experiencing the same issue:
OS: Windows 10 x64 Node version: v4.4.6
Work's on Linux 64 without problems.
Build folder contents and package contents screenshot:
@vzamanillo I don't think this is related as this issue should produce an executable which fails opening with 7zip, but according to your screenshot, it worked as expected.
May I make sure what does "works on Linux 64 without problems" mean? "I run nwjs-builder
on Linux and the Windows build works", or "I run nwjs-builder
on Windows and the Linux build works"?
BTW what's your npm version? Did you try --production
flag?
The linux build works (the package is created and app starts normally via ./app
), in windows the build package is created but when execute it opens the following window
npm version: 2.15.8
The gulp task:
var gulp = require('gulp'),
glp = require('gulp-load-plugins')(),
nwb = require('nwjs-builder'),
argv = require('yargs').alias('p', 'platforms').argv,
paths = {
base: './',
build: './build',
src: './src',
css: './src/css',
images: './src/images',
language: './src/language',
lib: './src/lib',
templates: './src/templates',
themes: './src/themes',
vendor: './src/vendor'
},
detectCurrentPlatform = function () {
switch (process.platform) {
case 'darwin':
return process.arch === 'x64' ? 'osx64' : 'osx32';
case 'win32':
return (process.arch === 'x64' || process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432')) ? 'win64' : 'win32';
case 'linux':
return process.arch === 'x64' ? 'linux64' : 'linux32';
}
};
// cleans build directory
gulp.task('clean:build', function () {
return gulp.src(paths.build, {
read: false
}).pipe(glp.clean());
});
gulp.task('build', ['clean:build'], function () {
return new Promise(function (resolve, reject) {
nwb.commands.nwbuild(paths.src, {
version: '0.15.4',
platforms: argv.p ? argv.p : detectCurrentPlatform(),
withFFmpeg: true,
production: true,
macIcns: paths.images + '/popcorntime.icns',
winIco: paths.images + '/popcorntime.ico',
sideBySide: false,
//outputFormat: 'ZIP',
outputDir: paths.build
}, function (err) {
if (err) {
reject(err);
}
return resolve();
});
});
});
@vzamanillo What about unzipping devapp.exe
to a directory and nw.exe <THAT_DIR>
to see if it works? You can make use of decompressed nw.js prebuilts in $HOME/.nwjs-builder/
.
Unzipping devapp.exe
and executing from $HOME/.nwjs-builder/caches/binary-nwjs-v0.15.4-win-x64
works, the application runs as expected, in fact, with sideBySide: true
works too... Do I missed something?
@vzamanillo Hmmm. It's weird. Have you tried other versions of nw.js?
NW.js 0.16.0-beta2: app does not run. NW.js v0.15.4: app does not run. NW.js v0.14.6: app does not run.
:/
:/
@vzamanillo I didn't find many differences between the building procedures for Linux and Windows. The last straw is to unzip the devapp.exe
to a directory, pack contents of that directory as a .zip
file, combine it with the executable with copy /b
and see if it still works. If it works, then it should be an issue with util.ZipDirectory
or util.CombineExecutable
(but Linux builds use nearly the same steps as Windows').
BTW the sideBySide: false
option will create a temporary .zip
, which will be combined to the executable later. If you are interested in inspecting it, or try combining it on your own, the following modifications should do the tricks (you should be able to identify them in the compiled files by comparing the contexts):
require('temp').track()
to require('temp')
, which will no longer clean up the temporary filestemp.path()
to a variable, print it and pass it to the corresponding slot of NWB.util.ZipDirectory
If all of the above refuse to work, you can always send me a sample which I can play with and I will see what I can do for you. Good luck to you.
@evshiron , thank you very much for your help, I tried zipping the contents of my src
folder to a package.nw
file, and then do the combined executable with copy /b nw.exe+package.nw app.exe
, same results, the application does not start and shows the default NW.js window... I will keep testing to find the problem.
@vzamanillo You are welcome. Using an earlier version of nw.js like 0.14.4 might help. I don't know.
Finally I got the way to do it work but I still without know what the problem was, I think is related to long paths in node_modules
on Windows but I am not really sure because I find no way to debug NW.js when application runs, I tried with Sawbuck with no luck and I tried building the application with the SDK flavor and "chromium-args": "--enable-logging --v=1"
, in the app manifest with no luck too (the log does not contains concrete information).
The steps to build the package and do it work:
%appdata%/npm
and %appdata%/npm-cache
node_modules
in the main src application directory (I got multiple errors about removing the directory due to long paths)@vzamanillo LOL that's why I asked about npm version first (but I thought you were using npm 3 when you said your node.js version was 4.4.6 and missed that "npm version: 2.15.8"). npm 3 uses a flat node_modules
structure rather than the recursive structure from npm 2, in order to solve this long path issue.
I guess it's because nw.js unzips the combined .zip
into %TEMP%
, combined with %TEMP%
some of the files get an absolute path longer than 256 characters, failing the unzipping process and thus nw.js opens with a default window.
I see, seems like it's a pretty old (and known) problem when building packages in Windows OS, I did find a lot of information about (too late :/), but I am glad because I learned much things about how NW.js works (LOL), in the other hand, I would like to help you with the original issue, I will try it.
Thank you one more time.
@vzamanillo That's really helpful. I use nvm-windows to switch node.js versions on Windows, which should bring convenience when you do the tests.
To test it, read CONTRIBUTING for the preparing steps. After npm test
, the Windows build will be produced in temp/build/nwb-test-win-ia32/
. Launch NWBTest.exe
and see if it exits immediately.
If it doesn't and a default window shows up, see if it can be unzipped using 7zip. If not, then it's the issue.
The node.js versions to be tested are: 0.10, 0.11, 4.0, 4.1, 5.0 and 6.0 (LOL).
Build results (Windows 10, 64 bits):
nw.js exits with code 233
& manually tested) nw.js exits with code 233
& manually tested)nw.js exits with code 233
& manually tested)nw.js exits with code 233
& manually tested)nw.js exits with code 233
& manually tested)I can not test 0.10
and 0.11
because not compatible module version found for debug
, decompress-zip
, etc...
@vzamanillo The "nw.js exits with code 233" is for testing nwb nwbuild -r
only. You will have to launch that NWBTest.exe
manually after each build.
node.js 0.10 and 0.11 shouldn't have problems according to https://ci.appveyor.com/project/evshiron/nwjs-builder/ (the builds failed because it can't clean up temporary files, but if you read the logs, you will find the dependencies were installed successfully).
Can't run test with node 0.10
and node 0.11
npm ERR! Error: No compatible version found: debug@'^2.2.0'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.1.0","0.2.0","0.3.0","0.4.0","0.4.1","0.5.0","0.6.0","0.7.0","0.7.1","0.7.2","0.7.3","0.7.4","0.8.0","0.8.1","1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","2.0.0","2.1.0","2.1.1","2.1.2","2.1.3","2.2.0"]
npm ERR! at installTargetsError (C:\Users\vzamanillo\AppData\Roaming\nvm\v0.10.0\node_modules\npm\lib\cache.js:682:10)
npm ERR! at C:\Users\vzamanillo\AppData\Roaming\nvm\v0.10.0\node_modules\npm\lib\cache.js:597:10
npm ERR! at saved (C:\Users\vzamanillo\AppData\Roaming\nvm\v0.10.0\node_modules\npm\node_modules\npm-registry-client\lib\get.js:138:7)
npm ERR! at Object.oncomplete (fs.js:93:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\desarrollo\GitWorkspace\nwjs-builder
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
If I ignore it and try to run the tests
C:\desarrollo\GitWorkspace\nwjs-builder>npm test
> nwjs-builder@1.13.1 pretest C:\desarrollo\GitWorkspace\nwjs-builder
> npm run build
> nwjs-builder@1.13.1 build C:\desarrollo\GitWorkspace\nwjs-builder
> babel -d . ./src/
"babel" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
npm ERR! nwjs-builder@1.13.1 build: `babel -d . ./src/`
npm ERR! `cmd "/c" "babel -d . ./src/"` failed with 1
npm ERR!
npm ERR! Failed at the nwjs-builder@1.13.1 build script.
npm ERR! This is most likely a problem with the nwjs-builder package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel -d . ./src/
npm ERR! You can get their info via:
npm ERR! npm owner ls nwjs-builder
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! cwd C:\desarrollo\GitWorkspace\nwjs-builder
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\desarrollo\GitWorkspace\nwjs-builder\npm-debug.log
npm ERR! not ok code 0
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
@vzamanillo Oh, I have encountered this issue before, because of npm 1. Try using latest version of node.js like 0.10.44 and 0.11.16.
Build results (Windows 10, 64 bits):
nw.js exits with code 233
& manually tested) nw.js exits with code 233
& manually tested) nw.js exits with code 233
& manually tested) nw.js exits with code 233
& manually tested)nw.js exits with code 233
& manually tested)nw.js exits with code 233
& manually tested)nw.js exits with code 233
& manually tested)@vzamanillo Thanks a lot for the help!
There are bytes missing at the end of the outcome, which fails nw.js loading. But things do work on node.js 4.1.0 and later.