如何摆脱Connect 3.0的弃用警报? [英] How to get rid of Connect 3.0 deprecation alert?

查看:119
本文介绍了如何摆脱Connect 3.0的弃用警报?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个使用express.js创建网络应用程序的node.js开发人员。
现在,我的问题是:

I'm a node.js developer who creates web apps using express.js. By now, my problem is:

每当我在我的电脑上创建一个应用程序,npm安装它的东西并运行它(使用节点app.js和nodemon )我在控制台中收到此消息:

Whenever I create an app on my computer, npm install its stuff and run it (with node app.js and nodemon) I get this message in the console:

connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
Express server listening on port 3000

应用程序工作,没关系。但是当我克隆在其他计算机上创建的应用程序时,我没有收到这个消息,所以我假设我的电脑已经过时了。

The app works, that's fine. But when I clone an app created in other computer I don't get that message, so I'm supposing I have something outdated in my computer.

我去了消息中提到的网站确认了我的猜测。这是一个弃用警告。但是,我已经更新了节点和npm并在全球快递,但我仍然收到了这个说明。

I went to the site mentioned in the message and confirmed my speculations. That is a deprecation warning. However, I've updated node and npm and globally express but I still getting the note.

因此,我的问题是:我不知道我需要更新什么才能摆脱弃用笔记,因为它让我失望了。

My problem is, therefore: I don't know what do I need to update in order to get rid of the deprecation notes because they're freaking me out.

我希望有人能帮助我。
非常感谢

I hope someone can help me. Thanks a lot.

推荐答案

这是一个警告,一旦Express更新使用Connect 3.0 - 作为临时修复,将按照说明进行操作 https://github.com/senchalabs/connect/wiki/Connect-3.0 的顶部。具体来说,在您的应用程序中找到这一行:

This is a warning that will go away once Express updates to use Connect 3.0 - as a temporary fix, follow the instructions at the top of https://github.com/senchalabs/connect/wiki/Connect-3.0. Specifically, find this line in your app:

app.use(express.bodyParser());

将其替换为以下内容(这是 bodyParser 将在3.0):

And replace it with the following (this is what bodyParser will be in 3.0):

app.use(express.json());
app.use(express.urlencoded());

这篇关于如何摆脱Connect 3.0的弃用警报?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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