evshiron / nwjs-builder

https://www.npmjs.com/package/nwjs-builder
76 stars 12 forks source link

Fatal error: Unable to load file #16

Closed nicklaw5 closed 8 years ago

nicklaw5 commented 8 years ago

OS: Windows 10 Node: v5.1.0 npm: 3.3.12

Nick@DESKTOP-78VVOH6 MINGW64 /f/Code/stryve-app/build (v0.3.0-beta)
$ nwb nwbuild -v 0.14.4-sdk -p win32,win64 --win-ico ./favicon.ico  ../
{ version: 'v0.14.4',
  flavor: 'sdk',
  targets: [ [ 'win', 'x86' ], [ 'win', 'x64' ] ],
  path: '../' }
0: Read package.json
1: Prepare build directory at stryve-app-win-ia32
2: Copy binary from C:\Users\Nick\.nwjs-builder\caches\binary-nwjs-sdk-v0.14.4-win-ia32
3: Make working directory
4: Compress application
5: Combine executable at stryve-app-win-ia32\nw.exe
6: Edit Windows executable
Fatal error: Unable to load file

I run all my code from a secondary drive (F:) as opposed to C:. Would that make any difference?

Also worthy to note that the below worked

Nick@DESKTOP-78VVOH6 MINGW64 /f/Code/stryve-app/build (v0.3.0-beta)
$ nwb nwbuild -v 0.14.4-sdk -p win32,win64 --win-ico ../favicon.ico --side-by-side ../
{ version: 'v0.14.4',
  flavor: 'sdk',
  targets: [ [ 'win', 'x86' ], [ 'win', 'x64' ] ],
  path: '../' }
0: Read package.json
1: Prepare build directory at stryve-app-win-ia32
2: Copy binary from C:\Users\Nick\.nwjs-builder\caches\binary-nwjs-sdk-v0.14.4-win-ia32
3: Make working directory
4: Copy application from C:\Users\Nick\AppData\Local\Temp\d-116418-4108-1cltum8
5: Edit Windows executable
6: Rename application to stryve-app.exe
7: Done
win-ia32 build: F:\Code\stryve-app\build\stryve-app-win-ia32.

0: Read package.json
1: Prepare build directory at stryve-app-win-x64
2: Copy binary from C:\Users\Nick\.nwjs-builder\caches\binary-nwjs-sdk-v0.14.4-win-x64
3: Make working directory
4: Copy application from C:\Users\Nick\AppData\Local\Temp\d-116418-4108-1u5ct2z
5: Edit Windows executable
6: Rename application to stryve-app.exe
7: Done
win-x64 build: F:\Code\stryve-app\build\stryve-app-win-x64.
evshiron commented 8 years ago

The "Unable to load file" is printed from https://github.com/atom/rcedit/blob/master/src/main.cc#L100. I currently can't make it appear on Windows 7, and I presume it's a related to the terminal you are using (I use the Git Bash from Git for Windows). Can you please prepend a console.log(rcedit, args); to $DIR_NWJS_BUILDER/node_modules/rcedit/lib/rcedit.js#29 (https://github.com/atom/node-rcedit/blob/master/src/rcedit.coffee#L27), so that we can find if there is a difference in the arguments? Thanks.

nicklaw5 commented 8 years ago

@evshiron I'm also using Git for Windows.

Here is the args dump:

Nick@DESKTOP-78VVOH6 MINGW64 /f/Code/stryve-app/build (v0.3.0-beta)
$ nwb nwbuild -v 0.14.4-sdk -p win32,win64 --win-ico ./favicon.ico  ../
{ version: 'v0.14.4',
  flavor: 'sdk',
  targets: [ [ 'win', 'x86' ], [ 'win', 'x64' ] ],
  path: '../' }
0: Read package.json
1: Prepare build directory at stryve-win-ia32
2: Copy binary from C:\Users\Nick\.nwjs-builder\caches\binary-nwjs-sdk-v0.14.4-win-ia32
3: Make working directory
4: Compress application
5: Combine executable at stryve-win-ia32\nw.exe
6: Edit Windows executable
C:\Users\Nick\AppData\Roaming\npm\node_modules\nwjs-builder\node_modules\rcedit\bin\rcedit.exe [ 'stryve-win-ia32\\nw.exe',
  '--set-version-string',
  'ProductName',
  'stryve',
  '--set-version-string',
  'FileDescription',
  'A socket.io-driven chat application.',
  '--set-version-string',
  'InternalName',
  'stryve',
  '--set-version-string',
  'CompanyName',
  'Stryve',
  '--set-version-string',
  'OriginalFilename',
  'stryve',
  '--set-file-version',
  '0.3.0',
  '--set-product-version',
  '0.3.0',
  '--set-icon',
  './favicon.ico' ]
Fatal error: Unable to load file
evshiron commented 8 years ago

Not much difference here, but it failed to fail :(

nicklaw5 commented 8 years ago

Have tried all of the below but still unresolved:

All attempts resulted in the same error:

$ node_modules/nwjs-builder/bin/nwb nwbuild -v 0.14.4-sdk -p win32 ./
{ version: 'v0.14.4',
  flavor: 'sdk',
  targets: [ [ 'win', 'x86' ] ],
  path: './' }

0: Read package.json
1: Prepare build directory at stryve-win-ia32
2: Copy binary from C:\Users\Nick\.nwjs-builder\caches\binary-nwjs-sdk-v0.14.4-win-ia32
3: Make working directory
4: Compress application
5: Combine executable at stryve-win-ia32\nw.exe
6: Edit Windows executable
Fatal error: Unable to load file

Farewell!
evshiron commented 8 years ago

Greetings. Some other things I want to know:

nicklaw5 commented 8 years ago

@evshiron thanks for the suggested actions.

I will attempt to build from my work machine (also Windows 10). If that fails, I will try and build it on Windows 7 VM. I will also try on an example app.

If all else fails, I can provide you with my source files and you can take a look for yourself.

I'll report back soon.

evshiron commented 8 years ago

@nicklaw5 In nwjs-builder 1.8.1, I reorder the steps and the "Edit Windows executable" process now handles original executables rather than the combined ones. Could you please try it out and see if it makes any difference?

nicklaw5 commented 8 years ago

@evshiron Downloaded v1.10.3. Getting the below error now:

$ nwb nwbuild -v 0.14.4-sdk -p win32,win64 -o ./builds ./
{ version: 'v0.14.4',
  flavor: 'sdk',
  targets: [ [ 'win', 'x86' ], [ 'win', 'x64' ] ],
  path: './' }
0: Read package.json
1: Prepare build directory at builds\stryve-win-ia32
2: Copy binary from C:\Users\Nick\.nwjs-builder\caches\binary-nwjs-sdk-v0.14.4-win-ia32
3: Edit Windows executable
Fatal error: Unable to parse version string
evshiron commented 8 years ago

I am feeling weird. Could you please clone this repo and run npm install && npm test to see if all tests pass?

nicklaw5 commented 8 years ago

The test failed the first time I ran it with this error:

  1) module nwbuild#build should build in "./temp/build/":
     Error: timeout of 300000ms exceeded. Ensure the done() callback is being ca                                   lled in this test.
      at null.<anonymous> (F:\Code\nwjs-builder\node_modules\mocha\lib\runnable.                                   js:226:19)

But I assumed it just exceeded the maximum run time of 5 mins, so I ran it again and all 6 tests passed.

You can clone the repo yourself if you'd like:

git clone https://github.com/nicklaw5/stryve.git
npm install
npm run build  # builds neccessary webpack asset files
nwb nwbuild -v 0.14.4-sdk -p win32 -o ./builds ./  # assuming nwjs-builder is installed globally
evshiron commented 8 years ago

@nicklaw5 Thanks for your testing and the repo. It comes out to be that the version in your package.json isn't accepted by rcedit.exe, as it expects x.x.x[.x], thus "Fatal error: Unable to parse version string" happens. In nwjs-builder 1.10.4, I have extended some manifest options which enable you to custom the name, version and description rather than using the name, version and description from the package.json. You should be able to build with some additional changes to your package.json:

{
  ...,
  "nwjsBuilder": {
    "productVersion": "0.3.0"
  }
}

If there is further question, feel free to ask.

nicklaw5 commented 8 years ago

@evshiron thanks I will check it out when I get home from work.

nicklaw5 commented 8 years ago

@evshiron all good now. Thanks for your help.