weixin_44827068
因库
采纳率0%
2021-02-25 22:07

npm run build 打包项目报错

[webpack-cli] TypeError: compiler.getInfrastructureLogger is not a function
    at CLIPlugin.apply (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack-cli\lib\plugi
ns\CLIPlugin.js:77:32)
    at WebpackCLI.webpack (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack\lib\webpac
k.js:47:13)
    at WebpackCLI.createCompiler (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack-cli
\lib\webpack-cli.js:1678:29)
    at async WebpackCLI.buildCommand (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack
-cli\lib\webpack-cli.js:1785:20)
    at async Command.<anonymous> (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack-cli
\lib\webpack-cli.js:564:25)
    at async Promise.all (index 1)
    at async Command.<anonymous> (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack-cli
\lib\webpack-cli.js:1120:13)
npm ERR! code 2
npm ERR! path D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c webpack

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\StudySoftware\nodejs\node_cache\_logs\2021-02-25T13_51_33_135Z-debug.log

D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader>npm install style-loader --save-dev

added 11 packages, removed 4 packages, and changed 10 packages in 7s

D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader>npm run build

> meetwebpack@1.0.0 build
> webpack

[webpack-cli] TypeError: compiler.getInfrastructureLogger is not a function
    at CLIPlugin.apply (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack-cli\lib\plugi
ns\CLIPlugin.js:77:32)
    at WebpackCLI.webpack (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack\lib\webpac
k.js:47:13)
    at WebpackCLI.createCompiler (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack-cli
\lib\webpack-cli.js:1678:29)
    at async WebpackCLI.buildCommand (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack
-cli\lib\webpack-cli.js:1785:20)
    at async Command.<anonymous> (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack-cli
\lib\webpack-cli.js:564:25)
    at async Promise.all (index 1)
    at async Command.<anonymous> (D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader\node_modules\webpack-cli
\lib\webpack-cli.js:1120:13)
npm ERR! code 2
npm ERR! path D:\Workspace\IdeaVueProject\LearnVuejs\webpack的使用\03-webpack的loader
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c webpack

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\StudySoftware\nodejs\node_cache\_logs\2021-02-25T13_59_09_853Z-debug.log

 下面是版本信息

 "devDependencies": {
    "css-loader": "^3.6.0",
    "style-loader": "^2.0.0",
    "webpack": "^4.27.0",
    "webpack-cli": "^4.5.0"
  }
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • Lazy33 Lazy33 2月前

    尽量路径名称里面不要包含中文    还有 compiler.getInfrastructureLogger is not a function  这个你应该写错了

    点赞 评论 复制链接分享
  • weixin_43551840 我爱吃西瓜喵 2月前

    应该是webpack版本的问题

    点赞 评论 复制链接分享