In vscode, NPM run a vue2.X’s project directly threw an inexplicable error:
TypeError: Failed to load plugin 'vue' declared in '.eslintrc.js': createRequire is not a function
The general error description is as follows:
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.
How to Solve:
-
- 1. For VSCode, you can delete the eslint extension directly
-
- 2. Upgrade the node version to the latest or keep it consistent with the node version of your colleagues