Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

cordova 7.0.0 can't find module '../plugman/platforms/ios' #295

Closed
abdohossam5 opened this issue May 7, 2017 · 9 comments
Closed

cordova 7.0.0 can't find module '../plugman/platforms/ios' #295

abdohossam5 opened this issue May 7, 2017 · 9 comments
Labels
Milestone

Comments

@abdohossam5
Copy link

Problem

after upgrading to cordova 7.0.0 building for ios fail giving this error
Error: can't find module '../plugman/platforms/ios'

Steps to reproduce
  1. npm install -g cordova
  2. cordova build ios
System info
  • Platform: iOS & Android
  • Platform version: android 6.1.0 / ios 4.4.0
  • Cordova version: 7.0.0
  • Node version: 6.6.0
Temporary solution

same issue was reported in another plugin and there was a solution proposed by @peterpeterparker. I applied it to '/plugins/cordova-hot-code-push-plugin/scripts/lib/iosWKWebViewEngineSupport.js' and it seems to be working now.

function loadProjectFile() {
  var platform_ios;
  var projectFile;

  try {
    // try pre-5.0 cordova structure
    platform_ios = context.requireCordovaModule('cordova-lib/src/plugman/platforms')['ios'];
    projectFile = platform_ios.parseProjectFile(iosPlatformPath);
  } catch (e) {
    try{
      // let's try cordova 5.0 structure
      platform_ios = context.requireCordovaModule('cordova-lib/src/plugman/platforms/ios');
      projectFile = platform_ios.parseProjectFile(iosPlatformPath);
    } catch (e) {
      //try cordova 7.0
      var project_files = context.requireCordovaModule('glob').sync(path.join(iosPlatformPath, '*.xcodeproj', 'project.pbxproj'));

      if (project_files.length === 0) {
        throw new Error('does not appear to be an xcode project (no xcode project file)');
      }

      var pbxPath = project_files[0];

      var xcodeproj = context.requireCordovaModule('xcode').project(pbxPath);
      xcodeproj.parseSync();

      projectFile = {
        'xcode': xcodeproj,
        write: function () {
          var fs = context.requireCordovaModule('fs');

          var frameworks_file = path.join(iosPlatformPath, 'frameworks.json');
          var frameworks = {};
          try {
            frameworks = context.requireCordovaModule(frameworks_file);
          } catch (e) {
          }

          fs.writeFileSync(pbxPath, xcodeproj.writeSync());
          if (Object.keys(frameworks).length === 0) {
            // If there is no framework references remain in the project, just remove this file
            context.requireCordovaModule('shelljs').rm('-rf', frameworks_file);
            return;
          }
          fs.writeFileSync(frameworks_file, JSON.stringify(this.frameworks, null, 4));
        }
      };
    }

  }

  return projectFile;
}
chauthai pushed a commit to mobilexag/cordova-hot-code-push that referenced this issue May 8, 2017
Due to this [issue](apache/cordova-lib#526)
there is no `cordova-lib/src/plugman/platforms/ios` anymore.
The fix is taken from this
[issue](nordnet#295)
@nikDemyankov nikDemyankov added this to the 1.5.3 milestone May 8, 2017
@nikDemyankov
Copy link
Member

Should be fixed now in the master. Not yet released on npm, but will be soon.

@nikDemyankov
Copy link
Member

And thank you for the code :)

@andrewvmail
Copy link

I'm still getting the plugman issue for some reason. Used cordova plugin add https://github.com/nordnet/cordova-hot-code-push.git
And made sure I got the latest one with merged file ...

@abdohossam5
Copy link
Author

@andrewvmail make sure your the version you have in the plugins folder is using the updated code. also you might be using other plugins that have the same issue.

@renanss
Copy link

renanss commented May 18, 2017

for some reason using Cordova plugin add cordova-hot-code-push-plugin gives me the error. But after using cordova plugin add https://github.com/nordnet/cordova-hot-code-push.git it works fine. I checked that both install the same version . strange.

@janpio
Copy link

janpio commented May 25, 2017

cordova plugin add is probably using npm in the background which still has a version from 7 months ago...

@nikDemyankov
Copy link
Member

Uploaded a fix on npm.

@dfliess
Copy link

dfliess commented May 29, 2017

Hi, i still have this issue with v ## 1.5.3 (2016-05-27)
global packages:

@ionic/cli-utils : 1.2.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.2.0

local packages:

@ionic/cli-plugin-cordova : 1.1.2
@ionic/cli-plugin-ionic1  : 1.1.2
Ionic Framework           : ionic1 1.3.1

System:

Node       : v6.9.2
OS         : macOS Sierra
Xcode      : Xcode 8.3.2 Build version 8E2002
ios-deploy : 1.9.0
ios-sim    : 5.0.13
cordova build ios

Running command: XXXX/hooks/after_prepare/010_add_platform_class.js /Users/dfliess/Develop/goc-mobile
add to body class: platform-ios
CHCP Local Development Add-on:
    Setting config-file to local server: https://56c878b0.ngrok.io/chcp.json
    iOS bundle version set to 3
Swift support activation hook:
Error: Cannot find module '../plugman/platforms/ios'

Have already tried removing plugins and platform in all orders. it works without the plugin.

vimalb pushed a commit to vimalb/cordova-hot-code-push that referenced this issue Oct 10, 2017
Due to this [issue](apache/cordova-lib#526)
there is no `cordova-lib/src/plugman/platforms/ios` anymore.
The fix is taken from this
[issue](nordnet#295)
@zhanglin-doudou
Copy link

After I removed the plugin cordova-hot-code-push-local-dev-addon, The problem had disappeared.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants