不建议使用的警告:不推荐使用Tapable.plugin.在.hooks上使用新的API代替 [英] DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead

查看:3254
本文介绍了不建议使用的警告:不推荐使用Tapable.plugin.在.hooks上使用新的API代替的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试运行> Vuetify VueJS Cordova示例 ,但出现此错误在npm run dev

节点build/dev-server.js

node build/dev-server.js

正在启动开发服务器...(节点:1024)弃用警告:不推荐使用Tapable.plugin.在.hooks上使用新的API (节点:1024)不建议使用警告:不推荐使用Tapable.apply.称呼 直接在插件上应用

Starting dev server... (node:1024) DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks instead (node:1024) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead

如何解决? 我已经更新了所有NPM软件包,没有帮助.

How to fix it? I already update all NPM packages, didn't help.

推荐答案

弃用消息:

DeprecationWarning:不推荐使用Tapable.apply.致电申请 直接使用插件
不建议使用的警告:不推荐使用Tapable.plugin.在上使用新的API .hooks代替

DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead
DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks instead

只是警告:

这是所有遇到此消息的人的简要摘要.

Here is a quick summary for everyone encountering this message.

webpack 4正在使用新的插件系统,并且不赞成使用先前的API.有2条新警告:

webpack 4 is using a new plugin system and deprecates the previous APIs. There are 2 new warnings:

DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead
DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead

这些是警告..它们会输出到控制台,以警告我们的用户他们正在使用过时的API,因此应迁移到 最新的.

These are warnings. They are outputted to the console to warn our users that they are using an outdated API and should migrate to the newest.

它们只是文本信息,不是错误. 如果您看到DeprecationWarning,则可以忽略它 直到您必须更新到Webpack的下一个主要版本为止.

They are only a textual information, not errors. If you see a DeprecationWarning you can ignore it until you have to update to the next major version of webpack.

因此,您对此无能为力.

So there's nothing you have or should do about it.

除此之外,我相信您会收到类似以下的错误消息:

Other than that, I trust you are receiving an error like:

/tmp/my-project> npm run dev

> my-project2@1.0.0 dev /tmp/my-project/my-project
> node build/dev-server.js

> Starting dev server...
(node:29408) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
(node:29408) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead
/tmp/my-project/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 /tmp/my-project/node_modules/html-webpack-plugin/lib/compiler.js:81:51
    at compile (/tmp/my-project/node_modules/webpack/lib/Compiler.js:242:11)
    at hooks.afterCompile.callAsync.err (/tmp/my-project/node_modules/webpack/lib/Compiler.js:487:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/my-project/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/tmp/my-project/node_modules/tapable/lib/Hook.js:35:21)
    at compilation.seal.err (/tmp/my-project/node_modules/webpack/lib/Compiler.js:484:30)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/my-project/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/tmp/my-project/node_modules/tapable/lib/Hook.js:35:21)
    at hooks.optimizeAssets.callAsync.err (/tmp/my-project/node_modules/webpack/lib/Compilation.js:966:35)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/my-project/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/tmp/my-project/node_modules/tapable/lib/Hook.js:35:21)
    at hooks.optimizeChunkAssets.callAsync.err (/tmp/my-project/node_modules/webpack/lib/Compilation.js:957:32)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/my-project/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/tmp/my-project/node_modules/tapable/lib/Hook.js:35:21)
    at hooks.additionalAssets.callAsync.err (/tmp/my-project/node_modules/webpack/lib/Compilation.js:952:36)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/my-project/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-project@1.0.0 dev: `node build/dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-project@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

您应该将html-webpack-plugin更新为最新版本:

You should update your html-webpack-plugin to the latest version:

npm install --save-dev html-webpack-plugin@3

错误应该消失了.

这篇关于不建议使用的警告:不推荐使用Tapable.plugin.在.hooks上使用新的API代替的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆