ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
608 stars 303 forks source link

Ionic 2 | Cordova plugin error #1176

Open RockyRx opened 7 years ago

RockyRx commented 7 years ago

Hello,

I'm trying to add a custom Cordova plugin to an Ionic 2 application. This Ionic 2 application is just a sample project created from Ionic CLI with just three tabs.

The plugin is located here:- https://github.com/ModusCreateOrg/cordova-plugin-example

And this is what I did to install it.

  1. cordova plugin add --link ../cordova-plugin-example
    Saved plugin info for "com-moduscreate-plugins-echo" to config.xml
    ******************************************
    * Hello from post plugin add hook script *
    ******************************************
  2. ionic cordova platform add android
  3. ionic cordova build android

After the third step I'm getting the following error

Module not found: Error: Can't resolve 'cordova/exec' in '/media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/modusecho/www'
resolve 'cordova/exec' in '/media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/modusecho/www'
  Parsed request is a module
  using description file: /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/modusecho/package.json (relative path: ./www)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/modusecho/package.json (relative path: ./www)
    resolve as module
      looking for modules in /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules
        using description file: /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/package.json (relative path: ./node_modules)
          using description file: /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/package.json (relative path: ./node_modules/cordova/exec)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/cordova/exec doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/cordova/exec.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/cordova/exec.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/cordova/exec.json doesn't exist
            as directory
              /media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/cordova/exec doesn't exist
[/media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/cordova/exec]
[/media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/cordova/exec.ts]
[/media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/cordova/exec.js]
[/media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/cordova/exec.json]
[/media/a6272437-6419-4af5-ae86-5171b53c12af/Applications/TestPluginApp/node_modules/cordova/exec]
 @ ./node_modules/modusecho/www/ModusEcho.js 1:11-34
 @ ./src/pages/home/home.ts
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts
lemartva commented 7 years ago

Same problem any luck?

rgbsuede commented 6 years ago

Similar issues...

ionic cordova run android --device
Running app-scripts build: --platform android --target cordova
[11:05:19]  build dev started ... 
[11:05:19]  clean started ... 
[11:05:19]  clean finished in 3 ms 
[11:05:19]  copy started ... 
[11:05:19]  deeplinks started ... 
[11:05:19]  deeplinks finished in 109 ms 
[11:05:19]  transpile started ... 
[11:05:22]  transpile finished in 2.58 s 
[11:05:22]  preprocess started ... 
[11:05:22]  preprocess finished in less than 1 ms 
[11:05:22]  webpack started ... 
[11:05:22]  copy finished in 2.81 s 
Error: ./node_modules/cordova-plugin-jins-meme-backgrounding/www/jins_meme_plugin.js
Module not found: Error: Can't resolve 'cordova/argscheck' in '/home/r/github/BlyncSync/node_modules/cordova-plugin-jins-meme-backgrounding/www'
resolve 'cordova/argscheck' in '/home/r/github/BlyncSync/node_modules/cordova-plugin-jins-meme-backgrounding/www'
  Parsed request is a module
  using description file: /home/r/github/BlyncSync/node_modules/cordova-plugin-jins-meme-backgrounding/package.json (relative path: ./www)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /home/r/github/BlyncSync/node_modules/cordova-plugin-jins-meme-backgrounding/package.json (relative path: ./www)
    resolve as module
      looking for modules in /home/r/github/BlyncSync/node_modules
        using description file: /home/r/github/BlyncSync/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /home/r/github/BlyncSync/package.json (relative path: ./node_modules)
          using description file: /home/r/github/BlyncSync/node_modules/cordova/package.json (relative path: ./argscheck)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/r/github/BlyncSync/node_modules/cordova/argscheck doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/r/github/BlyncSync/node_modules/cordova/argscheck.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/r/github/BlyncSync/node_modules/cordova/argscheck.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/r/github/BlyncSync/node_modules/cordova/argscheck.json doesn't exist
            as directory
              /home/r/github/BlyncSync/node_modules/cordova/argscheck doesn't exist
[/home/r/github/BlyncSync/node_modules/cordova/argscheck]
[/home/r/github/BlyncSync/node_modules/cordova/argscheck.ts]
[/home/r/github/BlyncSync/node_modules/cordova/argscheck.js]
[/home/r/github/BlyncSync/node_modules/cordova/argscheck.json]
[/home/r/github/BlyncSync/node_modules/cordova/argscheck]
 @ ./node_modules/cordova-plugin-jins-meme-backgrounding/www/jins_meme_plugin.js 1:16-44
 @ ./src/providers/jins-meme/jins-meme.ts
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts,./node_modules/cordova-plugin-jins-meme-backgrounding/www/jins_meme_plugin.js
Module not found: Error: Can't resolve 'cordova/exec' in '/home/r/github/BlyncSync/node_modules/cordova-plugin-jins-meme-backgrounding/www'
resolve 'cordova/exec' in '/home/r/github/BlyncSync/node_modules/cordova-plugin-jins-meme-backgrounding/www'
  Parsed request is a module
  using description file: /home/r/github/BlyncSync/node_modules/cordova-plugin-jins-meme-backgrounding/package.json (relative path: ./www)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /home/r/github/BlyncSync/node_modules/cordova-plugin-jins-meme-backgrounding/package.json (relative path: ./www)
    resolve as module
      looking for modules in /home/r/github/BlyncSync/node_modules
        using description file: /home/r/github/BlyncSync/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /home/r/github/BlyncSync/package.json (relative path: ./node_modules)
          using description file: /home/r/github/BlyncSync/node_modules/cordova/package.json (relative path: ./exec)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/r/github/BlyncSync/node_modules/cordova/exec doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/r/github/BlyncSync/node_modules/cordova/exec.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/r/github/BlyncSync/node_modules/cordova/exec.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/r/github/BlyncSync/node_modules/cordova/exec.json doesn't exist
            as directory
              /home/r/github/BlyncSync/node_modules/cordova/exec doesn't exist
[/home/r/github/BlyncSync/node_modules/cordova/exec]
[/home/r/github/BlyncSync/node_modules/cordova/exec.ts]
[/home/r/github/BlyncSync/node_modules/cordova/exec.js]
[/home/r/github/BlyncSync/node_modules/cordova/exec.json]
[/home/r/github/BlyncSync/node_modules/cordova/exec]
 @ ./node_modules/cordova-plugin-jins-meme-backgrounding/www/jins_meme_plugin.js 2:11-34
 @ ./src/providers/jins-meme/jins-meme.ts
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts
    at new BuildError (/home/r/github/BlyncSync/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at callback (/home/r/github/BlyncSync/node_modules/@ionic/app-scripts/dist/webpack.js:121:28)
    at emitRecords.err (/home/r/github/BlyncSync/node_modules/webpack/lib/Compiler.js:269:13)
    at Compiler.emitRecords (/home/r/github/BlyncSync/node_modules/webpack/lib/Compiler.js:375:38)
    at emitAssets.err (/home/r/github/BlyncSync/node_modules/webpack/lib/Compiler.js:262:10)
    at applyPluginsAsyncSeries1.err (/home/r/github/BlyncSync/node_modules/webpack/lib/Compiler.js:368:12)
    at next (/home/r/github/BlyncSync/node_modules/tapable/lib/Tapable.js:218:11)
    at Compiler.compiler.plugin (/home/r/github/BlyncSync/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (/home/r/github/BlyncSync/node_modules/tapable/lib/Tapable.js:222:13)
    at Compiler.afterEmit (/home/r/github/BlyncSync/node_modules/webpack/lib/Compiler.js:365:9)
rahullahoria commented 6 years ago

Same