Electron builder code signing: bundle format unrecognized, invalid, or unsuitable - macos

I'm getting this error while trying to build my electron app using electron-builder on Mac with code signing. Identity is properly set on keychain.
Error: Command failed: codesign --sign Company Name --force /Users/nterms/Projects/my-app/dist/mac/MyApp.app/Contents/Resources/app.asar.unpacked/node_modules/electron-prebuilt/dist/Electron.app/Contents/Frameworks/Electron Framework.framework
/Users/nterms/Projects/my-app/dist/mac/MyApp.app/Contents/Resources/app.asar.unpacked/node_modules/electron-prebuilt/dist/Electron.app/Contents/Frameworks/Electron Framework.framework: bundle format unrecognized, invalid, or unsuitable
at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:477:12)
From previous event:
at tsAwaiter (/Users/nterms/Projects/my-app/node_modules/electron-builder/src/util/awaiter.ts:10:47)
at MacPackager.sign (/Users/nterms/Projects/my-app/node_modules/electron-builder/src/macPackager.ts:100:75)
at /Users/saranga/Projects/my-app/node_modules/electron-builder/src/macPackager.ts:80:26
From previous event:
at MacPackager.<anonymous> (/Users/nterms/Projects/my-app/node_modules/electron-builder/src/macPackager.ts:80:10)
at next (native)
From previous event:
at tsAwaiter (/Users/nterms/Projects/my-app/node_modules/electron-builder/src/util/awaiter.ts:10:47)
at Object.build (/Users/nterms/Projects/my-app/node_modules/electron-builder/src/builder.ts:195:52)
at Object.<anonymous> (/Users/nterms/Projects/my-app/node_modules/electron-builder/src/build-cli.ts:27:28)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3
However the building smoothly goes on the same app when packaging without code signing.
I'm on a Mac with OSX El Captain (10.11.6) and XCode is updated to the latest version.
Any help is greatly appreciated.

Ok, I found the issue and get it solved. Posting it here so that it will help someone else who has the same issue.
Error was raised due to electron-prebuilt was installed in the production node_modules folder. It should only be installed in development modules.
I removed the electron-prebuilt from production modules and it works fine now.

Related

Getting error when trying to run Ganache (forking BSC chain)

I have installed Ganache following instructions from https://github.com/trufflesuite/ganache#documentation
I am trying to fork BSC chain for which I have a node running locally which is fully synced (I want to fork this for which I have provided the URL in package.json under scripts).
When trying to run Ganache using npm run ganache it is giving me this error. Any idea how can I solve this?
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.__webpack_require__.f.require (/usr/local/lib/node_modules/ganache/dist/node/cli.js:2:21481)
at /usr/local/lib/node_modules/ganache/dist/node/cli.js:2:20777
at Array.reduce (<anonymous>)`
Supposedly it was supposed to run after this, so why i am getting this error?
Check your Node.js version:
node -v
v18.13.0
Version must be >= v14.0.0. After updating to the latest Node.js version, the error no longer occurred for me.

Keystone.js app startup fails on Heroku due to missing importer?

My Keystone.js 4 project using Node 10.15 is failing to start on Heroku:
Error: Cannot find module './lib/core/importer'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/app/node_modules/keystone/index.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Process exited with status 1
State changed from crashed to starting
Starting process with command `node ./dist/keystone.js`
State changed from starting to crashed
Process exited with status 1
internal/modules/cjs/loader.js:583
throw err;
I have other Keystone applications configured in exactly the same way that run correctly.
I have tried disabling the build cache, creating a new application instance to deploy to and have verified through the Heroku console that the file in question does exist in the source.
The project builds and runs correctly in Windows 10 and *nix environments locally.
What can I do to debug this?
So it seems the problem is due to npm 6.5.x not installing all of Keystone's dependencies. Switching to Yarn as the package manager fixes this.
I installed the latest version of Yarn, 1.13.0 as of now.
Installed dependencies via yarn
Committed the yarn.lock file
Specified "yarn": "1.13.0" in the "engines" section of my package.json and removed "npm" from the engines.
Re-deployed to Heroku and it works as expected.
Hope this helps someone!

Assertion Error while compiling Solidity code in Ethereum

H:\Ethereum\Kickstarter\ethereum>node compile.js
H:\Ethereum\Kickstarter\node_modules\solc\soljson.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath"normalize";var ret=nodeFS"readFileSync";if(!ret
AssertionError [ERR_ASSERTION]: Invalid callback specified.
at wrapCallback (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:16:5)
at runWithReadCallback (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:37:42)
at compileStandard (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:78:14)
at Object.compileStandardWrapper (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:85:14)
at Object. (H:\Ethereum\Kickstarter\ethereum\compile.js:19:21)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
The following would get the latest stable version of the Solidity Compiler:
npm install --save solc
For me the issue was with this version. I downgraded solc using the following command to an older version (after removing the currently installed version).
npm install --save solc#0.4.17
This resolved the issue. Furthermore, I changed the first line of my smart contract in my contracts directory to:
pragma solidity ^0.4.17;
run following command, as suggested by Divyanshu
npm install --save solc#0.4.17
and verify that the first line of your contract is
pragma solidity ^0.4.17;

Appcelerator Studio - not loading after upgrade

I've just upgraded to the new version of Appcelerator Studio and now when I try to start it I get an error.
When I start the app I'm asked for my email and password and after entering credentials I get the following error message:
Login Error
module.js:327
throw err;
^
Error: Cannot find module 'fstream'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/node_modules/appcelerator/node_modules/tar/lib/entry.js:14:15)
at Module._compile (module.js:387:26)
at Object.Module._extensions.js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
I've also tried downloading setup from the site and reinstalling - didn't help.
I'm running on MAC OS X.
I've had this as well, thought it was some kind of an issue at my system, but I'll report it.
You can resolve this by reinstalling the Appcelerator CLI:
sudo npm i -g appcelerator
appc use 5.2.0 --force
I tried to reinstall cli and got this:
Annas-iMac:bin annakozy$ sudo npm i -g appcelerator
Password:
npm WARN install:object-assign ENOENT: no such file or directory, rename '/usr/local/etc/lib/node_modules/appcelerator/node_modules/got/node_modules/object-assign' -> '/usr/local/etc/lib/node_modules/appcelerator/node_modules/got/node_modules/object-assign'
npm WARN install:ansi-regex ENOENT: no such file or directory, rename '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-regex' -> '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-regex'
npm WARN install:ansi-styles ENOENT: no such file or directory, rename '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-styles' -> '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-styles'
npm WARN install:supports-color ENOENT: no such file or directory, rename '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/supports-color' -> '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/supports-color' object-assign#3.0.0 node_modules/appcelerator/node_modules/got/node_modules/object-assign -> node_modules/appcelerator/node_modules/got/node_modules/object-assign ansi-regex#2.0.0 node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-regex -> node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-regex ansi-styles#2.2.0 node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-styles -> node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-styles has-ansi#2.0.0 node_modules/appcelerator/node_modules/update-notifier/node_modules/has-ansi -> node_modules/appcelerator/node_modules/update-notifier/node_modules/has-ansi strip-ansi#3.0.1 node_modules/appcelerator/node_modules/update-notifier/node_modules/strip-ansi -> node_modules/appcelerator/node_modules/update-notifier/node_modules/strip-ansi supports-color#2.0.0 node_modules/appcelerator/node_modules/update-notifier/node_modules/supports-color -> node_modules/appcelerator/node_modules/update-notifier/node_modules/supports-color chalk#1.1.1 node_modules/appcelerator/node_modules/update-notifier/node_modules/chalk -> node_modules/appcelerator/node_modules/update-notifier/node_modules/chalk - /usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier node_modules/appcelerator/node_modules/update-notifier /usr/local/etc/lib └── (empty)
npm ERR! code 1

Cordova 4.3.0 - build command returns error Cannot find module 'Q'

After updating cordova to version 4.3.0 the command:
cordova build
returns the following error:
module.js:340
throw err;
^
Error: Cannot find module 'Q'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/lib/check_reqs.js:25:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
ERROR building one of the platforms: Error: /Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
I have already tried to remove and add the platform ios but nothing changes.
I have tried to run:
sudo npm install -g cordova / sudo npm install cordova
sudo npm install -g Q / sudo npm install Q
but nothing changes.
Any help?
Thank you very much
There was a bug and I have released a patch to it:
Apache Cordova ios - Git Repository
This is a bug shown on case-sensitive systems such as Unix, Linux and some OS X (if set as case-sensitive).
So far, to fix it, you have to locate those files containing a line like this:
Q = require('Q')
You can locate the files while standing on your project directory using grep:
grep -HnrI "require('Q" *;
then, use any text editor to manually change the mentioned line to:
Q = require('q')
Alternatively you can edit the related files on a more straight forward way by running the following command on your project directory:
grep -rl "require('Q" * | xargs sed -i "" "s/'Q'/'q'/g";
The single line above searches and edits the files that need the change.
Removing and then re-adding the platform again also works:
cordova platform remove ios
cordova platform add ios
Now you can cordova build ios :)
As mentioned by MeV this was a bug.

Resources