npm run serve报错

报错信息为:
Error loading C:\xxx\xxx\xxx\vue.config.js:
ERROR 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.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! artemis-plus@2.5.130 serve: vue-cli-service serve

可以看出是vue.config.js文件里面出了问题,Ignore Plugin这个地方的写法不对,之前是new webpack.IgnorePlugin(/^./locale/, /moment/) ,可以正常运行,删掉node_modules重新安装之后就报错了,正确的写法上面已经提示了:{ resourceRegExp, contextRegExp? } 这种,修改方式为:

vue.config.js

1
2
3
4
5
6
7
8
plugins: [
     // Ignore all locale files of moment.js
     // new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
     new webpack.IgnorePlugin({
       resourceRegExp: /^\.\/locale$/,
       contextRegExp: /moment$/,
     })
   ],

  

posted @   小溪河北  阅读(1247)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示