Vue-Cli开发服务器在安装软件包后抛出错误,掉进了一个兔子洞,现在我被卡住了

时间:2019-09-27 18:34:22

标签: npm webpack vue-cli

我正在使用Vue-cli,并且尝试安装npm软件包,但遇到有关缺少依赖项软件包的一些错误。经过一番谷歌搜索之后,我似乎需要更新webpack,所以我这样做了,在更新webpack时遇到了更多的错误,然后钻了个空洞,试图找出如何更新内容。

我的git repo包含了node_modules目录,所以我尝试通过git stashing重新开始,这样我可以回到开始npm进入地狱之前的状态。但这是行不通的,我手头一团糟,也不知道如何使vue-cli恢复到工作状态。

我根本无法编译vue开发服务器,我完全迷路了。当前在我的Vue项目中,当我尝试运行npm run dev时,我得到了:

DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
(node:800) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead
11% building 14/18 modules 4 active /home/chad/Documents/websites/fairway/team/client/node_modules/vue/dist/vue.esm.js/home/chad/Documents/websites/fairway/team/client/node_modules/html-webpack-plugin/lib/compiler.js:81
        var outputName = compilation.mainTemplate.applyPluginsWaterfall('asset-path', outputOptions.filename, {
                                                  ^

TypeError: compilation.mainTemplate.applyPluginsWaterfall is not a function
    at /home/chad/Documents/websites/fairway/team/client/node_modules/html-webpack-plugin/lib/compiler.js:81:51
    at compile (/home/chad/Documents/websites/fairway/team/client/node_modules/webpack/lib/Compiler.js:343:11)
    at hooks.afterCompile.callAsync.err (/home/chad/Documents/websites/fairway/team/client/node_modules/webpack/lib/Compiler.js:681:15)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/Hook.js:154:20)
    at compilation.seal.err (/home/chad/Documents/websites/fairway/team/client/node_modules/webpack/lib/Compiler.js:678:31)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.optimizeAssets.callAsync.err (/home/chad/Documents/websites/fairway/team/client/node_modules/webpack/lib/Compilation.js:1423:35)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.optimizeChunkAssets.callAsync.err (/home/chad/Documents/websites/fairway/team/client/node_modules/webpack/lib/Compilation.js:1414:32)
    at _err0 (eval at create (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at taskRunner.run (/home/chad/Documents/websites/fairway/team/client/node_modules/terser-webpack-plugin/dist/index.js:321:9)
    at TaskRunner.run (/home/chad/Documents/websites/fairway/team/client/node_modules/terser-webpack-plugin/dist/TaskRunner.js:48:7)
    at TerserPlugin.optimizeFn (/home/chad/Documents/websites/fairway/team/client/node_modules/terser-webpack-plugin/dist/index.js:227:18)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.additionalAssets.callAsync.err (/home/chad/Documents/websites/fairway/team/client/node_modules/webpack/lib/Compilation.js:1409:36)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/chad/Documents/websites/fairway/team/client/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.optimizeTree.callAsync.err (/home/chad/Documents/websites/fairway/team/client/node_modules/webpack/lib/Compilation.js:1405:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! team-client-app@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the team-client-app@1.0.0 dev 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/chad/.npm/_logs/2019-09-27T18_22_36_959Z-debug.log

如果我尝试运行npm install以确保所有内容均已更新,则会得到以下提示:

npm WARN babel-loader@7.1.2 requires a peer of webpack@2 || 3 but none is installed. You must install peer dependencies yourself.
npm WARN extract-text-webpack-plugin@3.0.2 requires a peer of webpack@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN file-loader@1.1.6 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN html-webpack-plugin@2.30.1 requires a peer of webpack@1 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3 but none is installed. You must install peer dependencies yourself.
npm WARN uglifyjs-webpack-plugin@1.1.6 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN schema-utils@0.4.3 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware@1.12.2 requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-server@2.11.5 requires a peer of webpack@^2.2.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

据我所知,这意味着babel-loader软件包需要与Webpack版本2或3一起使用,但是我们使用的是版本4 ...并且如果我降级到v3,我会因为其他需要v4 +的软件包。

所以我什至不知道从这里去哪里。救命!

0 个答案:

没有答案