[英]Error: Cannot find module 'babel-code-frame' in VUEJS ( ESLINT)
This is my current version :这是我当前的版本:
-npm: 6.14.4 -npm:6.14.4
-node: v10.19.0 -节点:v10.19.0
-eslint: v5.0.1 -eslint:v5.0.1
-linux: ubuntu 20.04 -linux:ubuntu 20.04
This is my script :这是我的脚本:
vue create vue1
cd vue1
npm run serve
This is my package.json :这是我的 package.json :
{
"name": "vue1",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^2.6.11"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
This is my trace log :这是我的跟踪日志:
INFO Starting development server...
ERROR Error: Cannot find module 'babel-code-frame'
Error: Cannot find module 'babel-code-frame'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/usr/share/nodejs/eslint/lib/formatters/codeframe.js:8:19)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at exports.loadModule (/home/logan/Desktop/vue-demo/vue1/node_modules/@vue/cli-shared-utils/lib/module.js:79:14)
at api.chainWebpack.webpackConfig (/home/logan/Desktop/vue-demo/vue1/node_modules/@vue/cli-plugin-eslint/index.js:59:26)
at webpackChainFns.forEach.fn (/home/logan/Desktop/vue-demo/vue1/node_modules/@vue/cli-service/lib/Service.js:236:40)
at Array.forEach (<anonymous>)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue1@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue1@0.1.0 serve 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! /home/logan/.npm/_logs/2021-04-22T15_06_46_861Z-debug.log
I'm also follow this solution in this link , but I dont know exactly how to do because of my poor understanding, I know there's something wrong with my ESLINT at at Object.<anonymous> (/usr/share/nodejs/eslint/lib/formatters/codeframe.js:8:19)
...Can you guys give me instruction?我也在此链接中遵循此解决方案,但由于我的理解不足,我不知道该怎么做,我知道我的 ESLINT 在
at Object.<anonymous> (/usr/share/nodejs/eslint/lib/formatters/codeframe.js:8:19)
...你们能给我指导吗? Thank you guys so much!!非常感谢你们!!
Have you run this command first npm install
prior to npm run serve
?您是否在
npm run serve
之前先运行此命令npm install
?
[SOLVED] I already solved this problem by uninstall npm, nodejs and reinstall them. [已解决] 我已经通过卸载 npm、nodejs 并重新安装它们解决了这个问题。
sudo apt-get remove npm
sudo apt-get remove nodejs
sudo apt-get install nodejs npm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.