Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema #265

Closed
ASHBAW opened this issue Aug 20, 2020 · 18 comments · Fixed by #272
Labels

Comments

@ASHBAW
Copy link

ASHBAW commented Aug 20, 2020

Description:
Creating a brand new angular based blank ionic 5 project gives an error when trying to run livereload:

Steps to Reproduce:
I create a brand new angular based starter - blank - Ionic 5 project via

ionic start test2

I then added the cordova android platform with the following command:

ionic cordova platform add android

I run the following command to do a livereload:

ionic cordova run android -l

Output:

ionic cordova run android -l
[INFO] Hardware device(s) found for android. Using --device.
> ng run app:ionic-cordova-serve --host=localhost --port=8100 --platform=android
[ng] An unhandled exception occurred: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
[ng]  - options[0] misses the property 'patterns'. Should be:
[ng]    [non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
[ng] See "/private/var/folders/1k/dwr2csfs5lnfrs7xq7520v_w0000gq/T/ng-K8HjCr/angular-errors.log" for further details.

[ERROR] ng has unexpectedly closed (exit code 127).
        
        The Ionic CLI will exit. Please check any output above for error details.

The error references another error log file. The contents are as follows:

[error] ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
 - options[0] misses the property 'patterns'. Should be:
   [non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
    at validate (/Users/b/ionic5_apps/tests/test2/node_modules/schema-utils/dist/validate.js:96:11)
    at new CopyPlugin (/Users/b/ionic5_apps/tests/test2/node_modules/copy-webpack-plugin/dist/index.js:24:30)
    at Object.webpackConfiguration (/Users/b/ionic5_apps/tests/test2/node_modules/@ionic/angular-toolkit/builders/cordova-serve/index.js:55:39)
    at setup (/Users/b/ionic5_apps/tests/test2/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:88:46)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

My ionic info:
Ionic CLI : 6.11.0 (/Users/b/.nvm/versions/node/v12.18.3/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.3.1
@angular-devkit/build-angular : 0.1000.6
@angular-devkit/schematics : 10.0.6
@angular/cli : 10.0.6
@ionic/angular-toolkit : 2.3.1

Cordova:

Cordova CLI : 10.0.0
Cordova Platforms : android 9.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 4 other plugins)

Utility:

cordova-res : 0.15.1
native-run : 1.0.0

System:

NodeJS : v12.18.3 (/Users/b/.nvm/versions/node/v12.18.3/bin/node)
npm : 6.14.6
OS : macOS Catalina
Xcode : Xcode 11.3.1 Build version 11C504


**Other Information:**
I created a repo with the starter project where I see the error:
https://github.com/ASHBAW/test_livereload

@rramosj2
Copy link

Same here. I just created a new ionic project and added the android platform. Same error. I am on windows. Everything was setup from scratch.

@Moinak99
Copy link

same here , i have to build apk every-time just to test the native plugins

@SimonBrazell
Copy link

SimonBrazell commented Aug 21, 2020

The solution (workaround) for me was to rollback the @ionic/angular-toolkit to the previous version, seems to be something up with v2.3.1.

npm i @ionic/angular-toolkit@2.3.0 -E -D

EDIT - Mention @dwieeb

@vibalani
Copy link

Please someone help!! as I am facing same issue from yesterday and it is annoying as I was not able to find any solution yet. All I could figure out that when options.patterns is getting used looks like it is empty. I am not sure how to assign it.

issue

@SimonBrazell
Copy link

@vibalani see my comment above.

@vibalani
Copy link

@SimonBrazell thanks a lot. I don't see the error now but when I run "ionic cordova run android --device -l -debug" it's been 10 minutes the app is still rendering and hasn't open. Hope it works but if I find any issues I will share here. Thanks again you were able to point to exact issue.

@SimonBrazell
Copy link

@vibalani I don't tend to use Android livereload a lot myself, but when I do I notice it does seem to take a long time to complete, hopefully a bit of patience will be all you need for that one 🙂

@Moinak99
Copy link

@SimonBrazell it worked ! , thanks a lot.

@vibalani
Copy link

@SimonBrazell the reason I mentioned it because from last 2 months I have been using Android livereload and it is up & running in 1 min or so. I saw a huge slowness and I might have messed up something while trying to fix this issue. Thanks!!

@SimonBrazell
Copy link

@vibalani oh right, maybe I'm thinking of iOS instead, good luck!

@shubham9237
Copy link

[ng] An unhandled exception occurred: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
[ng] - options[0] misses the property 'patterns'. Should be:
[ng] [non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
[ng] See "/private/var/folders/05/kwhj00r109l536wq_ff3xw9h0000gn/T/ng-pl8kyi/angular-errors.log" for further details.

[ERROR] ng has unexpectedly closed (exit code 127).

Same error for me also guyz , i cant work please help , i tried solution here but its not working for

@marshmallowsolutions
Copy link

We are facing the same issue from last night.

[ng] An unhandled exception occurred: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
[ng] - options[0] misses the property 'patterns'. Should be:
[ng] [non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
[ng] See "/private/var/folders/05/kwhj00r109l536wq_ff3xw9h0000gn/T/ng-V7WMQA/angular-errors.log" for further details.

[ERROR] ng has unexpectedly closed (exit code 127).

    The Ionic CLI will exit. Please check any output above for error details.

@imhoffd imhoffd changed the title New Ionic 5 starter project - livereload Cordova does not work Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema Aug 21, 2020
@mhartington mhartington transferred this issue from ionic-team/ionic-cli Aug 21, 2020
@mhartington
Copy link
Contributor

Thank you all for the report. Working on a fix

mhartington added a commit that referenced this issue Aug 21, 2020
Update outdated types and usage of copy-webpack-plugin

Closes #265
mhartington added a commit that referenced this issue Aug 21, 2020
Update outdated types and usage of copy-webpack-plugin

Closes #265
Ionitron added a commit that referenced this issue Aug 21, 2020
## [2.3.2](v2.3.1...v2.3.2) (2020-08-21)

### Bug Fixes

* **cordovaserve:** update copy-webpack to new format ([#272](#272)) ([c1e66b5](c1e66b5)), closes [#265](#265)
@Ionitron
Copy link
Collaborator

🎉 This issue has been resolved in version 2.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@marshmallowsolutions
Copy link

same error guys please assist

[ng] - options[0] misses the property 'patterns'. Should be:
[ng] [non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
[ng] See "/private/var/folders/05/kwhj00r109l536wq_ff3xw9h0000gn/T/ng-pl8kyi/angular-errors.log" for further details.

[ERROR] ng has unexpectedly closed (exit code 127).

@edsonmorais
Copy link

It worked for me. Thanks a lot!

npm i @ionic/angular-toolkit@2.3.0 -E -D

@gRegorLove
Copy link

This appears to still be happening with 2.3.3

[error] ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
 - options.patterns should be an non-empty array.
    at validate (\app-test\node_modules\schema-utils\dist\validate.js:98:11)
    at new CopyPlugin (\app-test\node_modules\copy-webpack-plugin\dist\index.js:24:30)
    at Object.webpackConfiguration (\app-test\node_modules\@ionic\angular-toolkit\builders\cordova-serve\index.js:52:39)
    at setup (\app-test\node_modules\@angular-devkit\build-angular\src\dev-server\index.js:88:46)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Environment:

Ionic:

   Ionic CLI                     : 5.4.16
   Ionic Framework               : @ionic/angular 5.5.1
   @angular-devkit/build-angular : 0.1000.8
   @angular-devkit/schematics    : 10.0.8
   @angular/cli                  : 10.0.8
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v12.19.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.14.8
   OS     : Windows 10

@mhartington
Copy link
Contributor

@gRegorLove Please open an new issue and provide a sample project.

@ionic-team ionic-team locked as resolved and limited conversation to collaborators Dec 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.