在webstorm中将node-express app.get()标记为未解决 [英] node-express app.get() marked as unresolved in webstorm

查看:178
本文介绍了在webstorm中将node-express app.get()标记为未解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您遵循JetBrains的在WebStorm指令中使用Node.js入门指令,可以正确突出显示节点表示的特定代码.但是,如果您创建自己的简单node-express项目,例如使用node-express'指南,然后对诸如app.get()之类的特定功能加下划线并标有以下内容警告:

If you follow JetBrains' Getting Started with Node.js in WebStorm instructions, node-express specific code is highlighted correctly. However if you create your own simple node-express project, e.g. using node-express' Guide, then express specific functions such as app.get() are underlined and marked with the following warning:

Unresolved function or method get()

即使您在Settings\JavaScript\Libraries下启用以下库,也会发生这种情况:

This happens even if you enable the following libraries under Settings\JavaScript\Libraries:

  • Node.js Globals
  • Node.js v0.10.31核心模块
  • express-DefinitelyTyped(您需要下载)

如何配置WebStorm来解决诸如app.get()之类的节点表示功能?

How can I configure WebStorm to resolve node-express functions such as app.get()?

推荐答案

在项目中使用express类型,而不是express defineTyped:

Instead of express definitelyTyped, use express types in your project:

npm install --save-dev @types/express

或者,对于纱线使用者:

Alternatively, for yarn users:

yarn add --dev @types/express

这篇关于在webstorm中将node-express app.get()标记为未解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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