Vue中Module build failed: Error: Cannot find module '@babel/core'最简单解决方案

这里写图片描述

s running at http://localhost:3000/
webpack output is served from /
Content not from webpack is served from e:\1804vuedemo\vueroutermedo/dist
Hash: 6cf951ad079ff750702e
Version: webpack 3.11.0
Time: 942ms
     Asset       Size  Chunks                    Chunk Names
    app.js     325 kB       0  [emitted]  [big]  main
app.js.map     385 kB       0  [emitted]         main
index.html  352 bytes          [emitted]
   [2] multi (webpack)-dev-server/client?http://localhost:3000 ./src/main.js 40 bytes {0} [built]
   [3] (webpack)-dev-server/client?http://localhost:3000 7.95 kB {0} [built]
   [4] (webpack)/node_modules/url/url.js 23.3 kB {0} [built]
   [7] (webpack)/node_modules/url/util.js 314 bytes {0} [built]
   [8] (webpack)/node_modules/querystring-es3/index.js 127 bytes {0} [built]
  [11] (webpack)-dev-server/node_modules/strip-ansi/index.js 161 bytes {0} [built]
  [12] (webpack)-dev-server/node_modules/ansi-regex/index.js 135 bytes {0} [built]
  [13] (webpack)-dev-server/node_modules/loglevel/lib/loglevel.js 7.86 kB {0} [built]
  [14] (webpack)-dev-server/client/socket.js 1.05 kB {0} [built]
  [15] (webpack)-dev-server/node_modules/sockjs-client/dist/sockjs.js 181 kB {0} [built]
  [16] (webpack)-dev-server/client/overlay.js 3.73 kB {0} [built]
  [18] (webpack)-dev-server/node_modules/html-entities/index.js 231 bytes {0} [built]
  [21] (webpack)/hot nonrecursive ^\.\/log$ 170 bytes {0} [built]
  [23] (webpack)/hot/emitter.js 77 bytes {0} [built]
  [25] ./src/main.js 791 bytes {0} [built] [failed] [1 error]
    + 11 hidden modules

ERROR in ./src/main.js
Module build failed: Error: Cannot find module '@babel/core'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (e:\1804vuedemo\vueroutermedo\node_modules\babel-loader\lib\index.js:5:15)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
 @ multi (webpack)-dev-server/client?http://localhost:3000 ./src/main.js
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40

vue程序跑起来,一直显示Module build failed: Error: Cannot find module ‘@babel/core’错误,网上收了很多方法,但是都太复杂,也许本身原因不一样,可以试试这个!
这里写图片描述

npm i babel-loader@7.1.5 -D
 
 
  • 1

直接安装的是6.26.3的版本,安装指定版本。然后npm run start ,问题解决。
希望对你有用!

Logo

前往低代码交流专区

更多推荐