update_platform_config.js terminates when there is a browser platform
For my case, I have a browser platform and an ios platform.
When processing the browser platform, it gets an exception and goes to process.stdout.write(e);. This terminates the script and so, the ios platform is not processed.
The script stops here:
Running command: [MY_PROJECT_DIR]/hooks/after_prepare/update_platform_config.js [MY_PROJECT_DIR]
net.js:633
throw new TypeError('invalid data');
^
TypeError: invalid data
at WriteStream.Socket.write (net.js:633:11)
at [MY_PROJECT_DIR]/hooks/after_prepare/update_platform_config.js:342:32
at arrayEach ([MY_PROJECT_DIR]/node_modules/lodash/index.js:1289:13)
at Function.<anonymous> ([MY_PROJECT_DIR]/node_modules/lodash/index.js:3345:13)
at [MY_PROJECT_DIR]/hooks/after_prepare/update_platform_config.js:336:11
at Object.<anonymous> ([MY_PROJECT_DIR]/hooks/after_prepare/update_platform_config.js:347:3)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
Error: Hook failed with error code 1: [MY_PROJECT_DIR]/hooks/after_prepare/update_platform_config.js
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:195:23
at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:797:24)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:823:30
at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1035:31)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:741:41)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:355:11)
I traced this down to the fact there appears to be no _.indexBy method in lodash. I ended up using the lodash.indexby module
add a require at the top of the file after the other requires:
var indexBy = require('lodash.indexby');
replace _.indexBy in the script with just plain indexBy and that fixed the problem
I just experienced the same thing. I am just going to fork my project and modify the code for the browser platform. This was not a huge deal to me, but we'll see how I feel after I get a bit farther in my development.
Hello,
The problem in my case was the <"preference name="StatusBarStyle" value="lightcontent"/>tag in my config.xml file.
I removed this line and the build worked.
Hello, Same problem, different case : After changing widget id of the application in the config.xml (to build a modified version of the application) ios platform still with old id. I tried to run grunt platform:add:android, it failed. I was needed to remove ios platform before.