简体   繁体   English

如何在Visual Studio 2015中为Node.js启用智能感知?

[英]How to enable intellisense for nodejs in visual studio 2015?

I have recently installed visual studio 2015. 我最近安装了Visual Studio 2015。

I have also installed nodejs tools for visual studio 2015 from its official source: 我还从官方来源为Visual Studio 2015安装了Node.js工具:

Visual Studio tools for nodejs 适用于Node.js的Visual Studio工具

Now I am able to create nodejs-express 4 projects inside visual studio 2015. I am able to do npm operations inside my editor too. 现在,我可以在Visual Studio 2015中创建nodejs-express 4项目。我也可以在编辑器中执行npm操作。

But I am not able to make intellisense working. 但是我无法使智能感知工作。

it does not show code suggestions. 它不显示代码建议。

Do I have to enable it manually? 我必须手动启用它吗?

I tried few blogs and tried to edit from : 我尝试了一些博客,并尝试从中进行编辑:

Tools => Options => Text Editor => NodeJs 工具=>选项=>文本编辑器=> NodeJs

but there is no nodejs option to configure.. only javascript is there. 但没有可配置的nodejs选项。只有javascript。

我的编辑器配置的屏幕截图

Also When I run npm install from my IDE , after installing node_modules it shows this message: 另外,当我从IDE运行npm install时,在安装node_modules之后会显示以下消息:

Could not find Typings package manager tool used for Intellisense 找不到用于Intellisense的Typings软件包管理器工具

any inputs? 有输入吗?

thanks 谢谢

We have the same problem with one VS2015 instance. 一个VS2015实例存在相同的问题。 It seems to behavior different from another one, in wich Node.js Tools for Visual Studio works fine. 它的行为似乎与另一行为不同,这是因为Visual Studio的Node.js工具可以正常工作。 I used a workaround to "turn IntelliSense on" in the machine where VS is showing the message "Could not find Typings package manager tool used for Intellisense". 我使用了一种变通方法来在VS显示消息“找不到用于Intellisense的Typings程序包管理器工具”的机器中“打开IntelliSense”。

  1. Closed the solution; 关闭解决方案;

  2. Uninstalled Typings npm local package: 卸载Typings npm本地软件包:

    npm uninstall typings -S (executed from project's folder) npm uninstall typings -S (从项目文件夹执行)

  3. Installed Typings npm as a global package: 将Typings npm作为全局软件包安装:

    npm install typings -g -S

  4. Installed Typings dictionaries globally: 在全球安装Typings词典:

     typings install dt~node --global --save typings install dt~express dt~serve-static dt~express-serve-static-core --global --save typings install dt~angular --global --save 
  5. Reopened the solution in Visual Studio 2015. 重新打开了Visual Studio 2015中的解决方案。

The message "Could not find Typings package manager tool used for Intellisense" still appears when the solution is opened, but IntelliSense is working. 打开解决方案后,仍然出现消息“找不到用于Intellisense的Typings程序包管理器工具”,但IntelliSense正在运行。

The problem seems to be sensitive to some configuration or software installed in each development machine, but we are not sure until now. 该问题似乎与每台开发机中安装的某些配置或软件有关,但我们目前尚不确定。

Regards, 问候,

我尝试了以下方法并且有效

npm install typings -g -S

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM