Refusing to run ionic cordova plugin inside a Capacitor project

I have a cordova app which I recently updated. Now when I try and add plugins I get this message. Ionic info output is

[WARN] Error loading @capacitor/core package.json: Error: Cannot find module '@capacitor/core/package'
       
       Require stack:
       - /usr/local/lib/node_modules/@ionic/cli/lib/project/index.js
       - /usr/local/lib/node_modules/@ionic/cli/lib/index.js
       - /usr/local/lib/node_modules/@ionic/cli/index.js
       - /usr/local/lib/node_modules/@ionic/cli/bin/ionic

Ionic:

   Ionic CLI                     : 6.12.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.4.0
   @angular-devkit/build-angular : 0.901.12
   @angular-devkit/schematics    : 10.0.8
   @angular/cli                  : 9.1.12
   @ionic/angular-toolkit        : 2.3.3

Capacitor:

   Capacitor CLI   : not installed
   @capacitor/core : not installed

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : ios 6.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 13 other plugins)

Utility:

   cordova-res (update available: 0.15.1) : 0.10.0
   native-run                             : not installed

System:

   ios-deploy : 1.10.0
   ios-sim    : 8.0.2
   NodeJS     : v13.11.0 (/usr/local/Cellar/node/13.11.0/bin/node)
   npm        : 6.14.5
   OS         : macOS Catalina
   Xcode      : Xcode 12.0.1 Build version 12A7300

What has gone wrong?

I’m experiencing the same problem, did you find any solution?

Do you have a capacitor.config.json file in your project directory? If so, remove it.

1 Like

Try this command

ionic integrations disable capacitor

21 Likes

tnk u so much, this aswer helped me a lot

Happened to me when I used the install script under capacitor tab (which is now the default tab) to install a plugin. I added the capacitor.config.json file and added capacitor inside of the ionic.config.json file.

Running the code below should fix it
ionic integrations disable capacitor
Or simply delete the capacitor.config file in the root of the project and the ‘capacitor’ entry in ionic.config.json under integrations

1 Like

is it possible to use code-push with for capacitor plugin?GitHub - mapiacompany/capacitor-codepush: Capacitor plugin for CodePush. I got this docs and tried the following steps. but when i use the codePush.sync() ,getting error this ‘registerPlugin’ is not exported from '@capacitor/core .Do you have any idea. I need to use code push with my capacitor project / i need to change my capacitor project to Cordova project. Please reply