在VScode中npm run了一个vue2.X的项目时直接抛出了一个莫名其妙的错误

TypeError: Failed to load plugin 'vue' declared in '.eslintrc.js': createRequire is not a function

大致错误描述如下:

 ERROR  Failed to compile with 1 error
                               16:42:37
Syntax Error: TypeError: Failed to load plugin 'vue' declared in '.eslintrc.js': createRequire is not a function
Referenced from: D:\codeSource\myProject\ldsz-cloud\ui-ldsz-adm\.eslintrc.js
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at _normalizeObjectConfigData.next (<anonymous>)


You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

处理方式:

  1. 针对于VSCode,可以直接删除eslint扩展
  2. 升级node版本至最新或与同事的node版本保持一致
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐