title: How can I fix issue on adding a cordova platform?
body: <p>I have a project which was developed two years ago from an other developer.</p>
  
  <p>Now I try to add platforms to this Cordova project. I am an newbie in things of developing mobile apps. </p>
  
  <p>If I add platforms like IOS, Android or Browser I get always the same error message. </p>
  
  <pre><code>Cannot read property 'variables' of undefined
  </code></pre>
  
  <p>I have Cordova "8.1.2 (cordova-lib@8.1.1)" installed via</p>
  
  <pre><code>sudo npm -g install cordova
  </code></pre>
  
  <p>The following error message I get if I add a platform</p>
  
  <pre><code>TypeError: Cannot read property 'variables' of undefined
      at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/restore-util.js:322:57
      at Array.forEach (&lt;anonymous&gt;)
      at Object.installPluginsFromConfigXML (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/restore-util.js:318:28)
      at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:58:32
      at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:854:54)
      at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:883:30
      at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:13)
      at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:624:44
      at runSingle (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:137:13)
      at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:125:13)
  </code></pre>
  
  <p>The part in file "restore-util.js:322:57" look like this:</p>
  
  <pre><code>    // Check to see if pkg.json plugin(id) and config plugin(id) match.
      if (comboPluginIdArray.toString() !== pluginIdConfig.toString()) {
          // If there is a config plugin that does NOT already exist in
          // comboPluginIdArray, add it and its variables.
          pluginIdConfig.forEach(function (item) {
              if (comboPluginIdArray.indexOf(item) &lt; 0) {
                  comboPluginIdArray.push(item);
                  var configXMLPlugin = cfg.getPlugin(item);
                  comboObject[item] = configXMLPlugin.variables;
                  modifiedPkgJson = true;
              }
          });
      }
  </code></pre>
  
  <p>Now I fix my issue: </p>
  
  <ol>
  <li>Remove all installed plugins from config.xml and package.json</li>
  <li>Remove node_modules folder</li>
  <li>Remove folders android, ios, browser from /platforms</li>
  <li>Install all plugins with cordova plugin install </li>
  <li>Run npm install</li>
  <li>At least build platforms cordova platform add </li>
  </ol>
  
  <p>I'm not sure, maybe some deprecated versions of plugins was installed. So I reinstall every plugin in project. I work since two days with ionic, cordova/phonegap and I think I will learn from day to day more about this topic.</p>