generator-ionic icon indicating copy to clipboard operation
generator-ionic copied to clipboard

update_platform_config.js terminates when there is a browser platform

Open objectkuan opened this issue 10 years ago • 4 comments

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)

objectkuan avatar Nov 06 '15 07:11 objectkuan

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

Paul-Todd avatar Feb 04 '16 10:02 Paul-Todd

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.

MT-- avatar Feb 10 '16 20:02 MT--

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.

jonaslsl avatar Feb 25 '16 21:02 jonaslsl

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.

olebrun avatar Mar 15 '16 16:03 olebrun