ValidationError:无效的选项对象。已使用与API模式不匹配的选项对象初始化了复制插件

时间:2020-08-12 15:19:08

标签: vue.js npm

由于漏洞,我刚刚更新了package.json中的某些软件包。所有漏洞都已修复,但是当我执行npm运行时出现以下错误。 我的漏洞修复过程中复制插件程序包已更新。

我尝试从较早的提交中复制package.json并重新安装所有软件包,但随后该漏洞再次出现。

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)

2 个答案:

答案 0 :(得分:1)

有关配置问题:

仅在webpack.common.js中适应以下部分

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') } }),

答案 1 :(得分:1)

我遇到了同样的问题,但在执行“tns debug android -no--hmr”时使用了 angular 11 和依赖项“@angular-devkit/build-angular”:“~0.1100.5”。

当我将 nativescript 更新到版本 7 时,文件“webpack.config.json”更改了 CopyWebpack,我通过输入之前的配置解决了错误,如图所示。

image