【问题标题】:ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schemaValidationError:无效的选项对象。 Copy Plugin 已使用与 API 模式不匹配的选项对象进行初始化
【发布时间】:2020-12-02 09:17:13
【问题描述】:

由于漏洞,我刚刚更新了 package.json 中的一些包。所有漏洞均已修复,但我执行 npm run 时出现以下错误。 复制插件包在我的漏洞修复期间得到了更新。

我尝试从旧的提交中复制 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)

【问题讨论】:

    标签: vue.js npm


    【解决方案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') } }),
    

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 2021-12-30
        • 1970-01-01
        • 2021-03-24
        • 2022-01-19
        • 2021-09-03
        • 2022-07-30
        • 2021-03-23
        • 2019-08-29
        • 1970-01-01
        相关资源
        最近更新 更多