Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

npm

vue.js

I just updated some of my packages in my package.json due to vulnerabilities. All vulnerabilities were fixed but the following error appeared when I did npm run. Copy Plugin package got updated during my vulnerability fix.

I tried copying package.json from older commits and reinstalling all packages, but then the vulnerability appears again.

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)
 - options[1] 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)
like image 713
Agus Mathew Avatar asked Dec 07 '25 13:12

Agus Mathew


2 Answers

For the configuration issues:

Adapt the following section in webpack.common.js only:

module.exports = {
  plugins: [
    new CopyWebpackPlugin({
      patterns: [
        { from: Path.resolve('./modules/web/static/'), to: './assets' },
        { from: Path.resolve('./modules/web/static/favicon.ico'), to: './' },
      ]
    }),
    new TsChecker({ typescript: { configFile: Path.resolve('tsconfig.json') } }),
like image 70
Agus Mathew Avatar answered Dec 10 '25 16:12

Agus Mathew


I had the same problem but with angular 11 and with the dependency "@angular-devkit/build-angular": "~0.1100.5" when executing "tns debug android -no--hmr".

When I updated nativescript to version 7 the file "webpack.config.json" changed the CopyWebpack, and I solved the error by entering the previous configuration as you can see in the image.

image

like image 40
Raquel Fernández González Avatar answered Dec 10 '25 16:12

Raquel Fernández González



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!