简体   繁体   English

WebStorm 未知的 HTML 标签 Angular 2

[英]WebStorm unknown HTML tag Angular 2

Just downloaded latest WebStorm trial to try out on existing Angular 2 CLI v6.2.4.刚刚下载了最新的 WebStorm 试用版,以在现有的 Angular 2 CLI v6.2.4 上试用。

I did the file open of my root project folder.我打开了我的根项目文件夹的文件。 I see all the files in IDE explorer.我在 IDE 资源管理器中看到了所有文件。 However cannot navigate code ( Ctrl + F1 ) says unknown HTML tag.但是无法导航代码( Ctrl + F1 )表示未知的 HTML 标记。

What are the steps to configure WebStorm for Angular 2?为 Angular 2 配置 WebStorm 的步骤是什么? I googled and also went to Settings -> Languages & Frameworks -> JS -> Libraries -> Add and not listed there.我用谷歌搜索并转到Settings -> Languages & Frameworks -> JS -> Libraries -> Add并没有在那里列出。

For "Create new project" I do see Angular listed but this is an existing CLI project created outside of WebStorm.对于“创建新项目”,我确实看到列出了 Angular,但这是在 WebStorm 之外创建的现有 CLI 项目。

Please advise how to setup.请指教如何设置。

Please make sure that AngularJS plugin is enabled in Preferences |请确保在Preferences | 中启用了AngularJS插件 Plugins and @angular node_modules are not excluded from project: Angular support is only enabled if node_modules/@angular folder is included in index.插件@angular node_modules 不会从项目中排除:仅当node_modules/@angular文件夹包含在索引中时,Angular 支持才启用。 Expand node_modules in Project tool window to check what @angular folder looks like there: excluded folders usually have orange color展开node_modulesProject工具窗口中检查一下什么@angular文件夹看起来像有:排除的文件夹通常有橙色

@Gullu, I'solved very similar error (PHPStorm's Code analysis would yell at me) by going where you said (Settings \\ Languages and Frameworks \\ Javascript \\ Libraries), button 'Download', and from there in dropdown I've selected typing for angular and angular-material (took me 2 steps). @Gullu,我解决了非常相似的错误(PHPStorm 的代码分析会冲我大喊大叫)通过去你说的地方(设置 \\ 语言和框架 \\ Javascript \\ 库),按钮“下载”,然后在下拉菜单中我选择了输入用于角形和角形材料(花了我 2 个步骤)。 All was fine after that.之后一切都很好。

Close Webstorm, delete node_modules and .idea folder.关闭 Webstorm,删除node_modules.idea文件夹。 Perform fresh install and open the project again.执行全新安装并再次打开项目。

Your dev dependencies are probably not installed.您的开发依赖项可能未安装。

try npm i --only=dev试试npm i --only=dev

And if this does not work it is probably the issue with the ide identifying the angular modules.如果这不起作用,则可能是 ide 识别角度模块的问题。

adding the node_modules in preferences > language and frameworks > javascript > libraries might helppreferences > language and frameworks > javascript > libraries添加 node_modules 可能会有所帮助

Here is how to do it:这是如何做到的:

  1. click add点击add
  2. An edit libary popup will open.将打开一个编辑库弹出窗口。
  3. Name the library anything you want.将库命名为您想要的任何名称。
  4. choose Node.js core modules as framework type.选择Node.js core modules作为框架类型。
  5. keep the visibility set on project .保持在project设置的可见性。
  6. we dont need to add anything in the documentation urls.我们不需要在文档 url 中添加任何内容。
  7. Now click on the first "+" button and add the node_modules directory from your project.现在单击第一个“+”按钮并从项目中添加 node_modules 目录。

After you have successully added the library, click on "apply" and then "ok".成功添加库后,单击“应用”,然后单击“确定”。

The ide will take some time depending on your processor but that processing is just one time only.For the subsequent loads it wont take that long. ide 将需要一些时间,具体取决于您的处理器,但该处理只是一次。对于后续加载,它不会花费那么长时间。 (PS: You can also restart the ide to reduce the memory usage just after all the modules the loaded) (PS:您也可以在所有模块加载完毕后重新启动ide以减少内存使用量)

在此处输入图片说明

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

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