发布时间:2023-04-23 文章分类:WEB开发, 电脑百科 投稿人:李佳 字号: 默认 | | 超大 打印
internal/modules/cjs/loader.js:985
  throw err;
  ^
Error: Cannot find module '@vue/cli-plugin-eslint'
Require stack:
- C:\Users\lenovo\AppData\Roaming\npm\node_modules\@vue\cli-service\lib\Service.js
- C:\Users\lenovo\AppData\Roaming\npm\node_modules\@vue\cli-service\bin\vue-cli-service.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at idToPlugin (C:\Users\lenovo\AppData\Roaming\npm\node_modules\@vue\cli-service\lib\Service.js:145:14)
    at C:\Users\lenovo\AppData\Roaming\npm\node_modules\@vue\cli-service\lib\Service.js:184:20
    at Array.map (<anonymous>)
    at Service.resolvePlugins (C:\Users\lenovo\AppData\Roaming\npm\node_modules\@vue\cli-service\lib\Service.js:170:10)
    at new Service (C:\Users\lenovo\AppData\Roaming\npm\node_modules\@vue\cli-service\lib\Service.js:32:25)
    at Object.<anonymous> (C:\Users\lenovo\AppData\Roaming\npm\node_modules\@vue\cli-service\bin\vue-cli-service.js:15:17) {    
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\lenovo\\AppData\\Roaming\\npm\\node_modules\\@vue\\cli-service\\lib\\Service.js',
    'C:\\Users\\lenovo\\AppData\\Roaming\\npm\\node_modules\\@vue\\cli-service\\bin\\vue-cli-service.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-touch-screen@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-touch-screen@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2022-09-14T11_03_44_204Z-debug.log

以上是我当时遇到的报错信息,

我按照网上的说法  先去安装全局的 @vue/cli-plugin-eslint

npm i -g @vue/cli-plugin-eslint

也没解决我的问题

然后又本地删掉包,再去安装一次包,也没解决

又用cnpm 安装,也未解决

又使用降级npm版本到6也未解决

最终的解决方案是在项目的根目录下有个 package.json

"nohoist": [
    "**/@vue/cli-plugin-eslint",
    "**/@vue/cli-plugin-eslint/**"
  ]

在里面添加一个这个 ,再删除包,重新安装,就能正常打包了

具体的参考文献在gethub上,

地址":use vue-cli with lerna and got Error: Cannot find module '@vue/cli-plugin-eslint' · Issue #4911 · vuejs/vue-cli · GitHub

 如果对您有帮助,那就请作者喝杯咖啡吧,欢迎点赞、评论、收藏