electron/rcedit

'Unable to set icon'

robi-wan opened this issue · 4 comments

Using the current rcedit artifact leads to the above mentioned error: 'Unable to set icon'.

The error was introduced in commit af37f5f.
(I verified this with artifacts from https://ci.appveyor.com/project/electron-bot/rcedit/build/1.0.23/job/bc57s50clgkbab7x/artifacts and https://ci.appveyor.com/project/electron-bot/rcedit/build/1.0.22/job/brndccen9f9ovdc2/artifacts. The artifact from the previous commit - d65120c - worked.)

The changes to the function SetIcon may have caused this.

Here is the test output from https://github.com/electron/node-rcedit with the artifact from https://ci.appveyor.com/project/electron-bot/rcedit/build/1.0.23/job/bc57s50clgkbab7x/artifacts:

>npm run test

> rcedit@0.9.0 test c:\development\work\rcedit\node-rcedit
> mocha test/*.js && npm run lint



  rcedit(exePath, options, callback)
    1) updates the information in the executable
    √ supports non-ASCII characters in the .exe path (703ms)
    2) supports a product version of 1
    3) supports a product version of 1.0
    √ supports setting requestedExecutionLevel to requireAdministrator (3250ms)
    √ supports replacing the manifest with a specified manifest file (3125ms)
    √ reports an error when the .exe path does not exist
    √ reports an error when the icon path does not exist
    √ reports an error when the file version is invalid (47ms)
    √ reports an error when the product version is invalid


  7 passing (26s)
  3 failing

  1) rcedit(exePath, options, callback) updates the information in the executable:
     Error: rcedit.exe failed with exit code 1. Fatal error: Unable to set icon
      at ChildProcess.<anonymous> (lib\rcedit.js:68:16)
      at maybeClose (internal/child_process.js:862:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)

  2) rcedit(exePath, options, callback) supports a product version of 1:
     Uncaught TypeError: Cannot read property 'trim' of undefined
      at node_modules\rcinfo\lib\index.js:32:27
      at Array.forEach (native)
      at node_modules\rcinfo\lib\index.js:27:15
      at ChildProcess.exithandler (child_process.js:207:5)
      at maybeClose (internal/child_process.js:862:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)

  3) rcedit(exePath, options, callback) supports a product version of 1.0:
     Uncaught TypeError: Cannot read property 'trim' of undefined
      at node_modules\rcinfo\lib\index.js:32:27
      at Array.forEach (native)
      at node_modules\rcinfo\lib\index.js:27:15
      at ChildProcess.exithandler (child_process.js:207:5)
      at maybeClose (internal/child_process.js:862:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)




npm ERR! Windows_NT 5.2.3790
npm ERR! argv "C:\\development\\tools\\nodejs\\node.exe" "C:\\development\\tools\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run
" "test"
npm ERR! node v4.8.4
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE
npm ERR! rcedit@0.9.0 test: `mocha test/*.js && npm run lint`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the rcedit@0.9.0 test script 'mocha test/*.js && npm run lint'.
npm ERR! This is most likely a problem with the rcedit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     mocha test/*.js && npm run lint
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs rcedit
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls rcedit
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\development\work\rcedit\node-rcedit\npm-debug.log

This output is from running the node-rcedit tests with a current artifact:

>npm run test

> rcedit@0.9.0 test c:\development\work\rcedit\node-rcedit
> mocha test/*.js && npm run lint



  rcedit(exePath, options, callback)
    1) updates the information in the executable
    √ supports non-ASCII characters in the .exe path (454ms)
    √ supports a product version of 1 (578ms)
    √ supports a product version of 1.0 (532ms)
    √ supports setting requestedExecutionLevel to requireAdministrator (2969ms)
    √ supports replacing the manifest with a specified manifest file (3016ms)
    √ reports an error when the .exe path does not exist
    √ reports an error when the icon path does not exist
    √ reports an error when the file version is invalid
    √ reports an error when the product version is invalid (62ms)


  9 passing (25s)
  1 failing

  1) rcedit(exePath, options, callback) updates the information in the executable:
     Error: rcedit.exe failed with exit code 1. Fatal error: Unable to set icon
      at ChildProcess.<anonymous> (lib\rcedit.js:68:16)
      at maybeClose (internal/child_process.js:862:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)




npm ERR! Windows_NT 5.2.3790
npm ERR! argv "C:\\development\\tools\\nodejs\\node.exe" "C:\\development\\tools\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run
" "test"
npm ERR! node v4.8.4
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE
npm ERR! rcedit@0.9.0 test: `mocha test/*.js && npm run lint`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rcedit@0.9.0 test script 'mocha test/*.js && npm run lint'.
npm ERR! This is most likely a problem with the rcedit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     mocha test/*.js && npm run lint
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs rcedit
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls rcedit
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\development\work\rcedit\node-rcedit\npm-debug.log

Thanks for finding out the troubling commit, I must have broken something when refactoring, I'll look into it.

still got same error:
electron-packager .--overwrite --platform=win32 --arch=x64 --icon=electronApp\icon --prune=true --out=release-builds
Packaging app for platform win32 x64 using electron v1.7.9
rcedit.exe failed with exit code 1. Fatal error: Unable to set icon

I don't think node-rcedit has been updated with this fix. There's a slight problem if you do that, anyway (see #66).

rcedit.exe failed with exit code 1. Reserved header is not 0 or image type is not icon for 'p'