关于 vue-antd-pro 项目 npm run serve 之后出现的一系列问题

哈,很久没写过随笔了,心情激荡

前景简要:

在运行项目时出了些问题,问题1如下

ValidationError: Invalid options object. Ignore Plugin has been initialized using an options object that does not match the API schema.
 - options should be one of these:
   object { resourceRegExp, contextRegExp? } | object { checkResource }
   Details:
    * options misses the property 'resourceRegExp'. Should be:
      RegExp
      -> A RegExp to test the request against.
    * options misses the property 'checkResource'. Should be:
      function
      -> A filter function for resource and context.
ValidationError: Invalid options object. Ignore Plugin has been initialized using an options object that does not match the API schema.

翻译 Invalid options object. Ignore Plugin has been initialized using an options object that does not match the API schema.  : 无效的选项对象。忽略插件已使用与API模式不匹配的选项对象进行初始化。

我开始认真琢磨(百度)

成功找到了以下解决方案

  • 删除项目内nodemodules的webpackpack所有版本, 执行 cnpm install webpack@4.46.0 --save-dev  (亲测)
  • vue.config.js (未测)       
    configureWebpack: {
        plugins: [
          // Ignore all locale files of moment.js
          // new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
          // 修改为这样:
    new webpack.IgnorePlugin({
            resourceRegExp: /^\.\/locale$/,
            contextRegExp: /moment$/,
          }),
          createThemeColorReplacerPlugin(),
        ],
      },

     

参考博文:

https://blog.csdn.net/baidu_28753677/article/details/125427526 

https://www.jianshu.com/p/ce64c76dcbda

好的问题解决了,抬走下一个

 

之后重新 serve 出现了问题2,如下

error in ./src/components/NumberInfo/NumberInfo.vue?vue&type=style&index=0&id=4370c5af&lang=less&scoped=true&

Syntax Error: TypeError: Cannot set properties of undefined (setting ‘parent’)

经过细密的研究之后发现了以下几个解决方案

  1. 把yarn.lock、node_modules删除,然后重新执行yarn install, npm run serve (无用)
  2. 删掉 components 文件夹下的NumberInfo 文件夹,再启动项目,启动之后, Ctrl + z 撤回删除的 NumberInfo 组件文件夹,之后,项目就可以正常启动了 (无用)
  3.  注释掉 /src/components/NumberInfo/NumberInfo.vue style 里面的 @import "index" (有效)

参考博文:

https://blog.csdn.net/weixin_44488149/article/details/125875450

好了,问一下,还有谁!

 

结尾问一个问题,为什么都是从一个库里面 clone 下来的代码 为何我可以顺利运行成功,而同事却出现了两三个问题


posted @ 2022-08-11 10:12  _whys  阅读(3504)  评论(1编辑  收藏  举报