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

13
我最近更新了我的package.json中的一些程序包,因为它们存在漏洞。所有漏洞都得到了修复,但是当我运行npm run时出现了以下错误: “Copy Plugin package got updated during my vulnerability fix.” 我尝试从旧的提交中复制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个回答

10

针对配置问题:

请仅修改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') } }),

4

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

当我将nativescript更新到7版本时,"webpack.config.json"文件更改了CopyWebpack,我通过输入先前的配置来解决错误,如您可以在图像中看到的那样。

image


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接