angular - 如何从 Intellij idea 2017.1 运行 Angular 应用程序?

标签 angular intellij-idea

如何从 Intellij Idea 运行配置菜单设置运行我的 angular 2 应用程序?

我只是在终端中输入 ng serve 但我应该从 Intellij Idea 的配置列表中选择什么?

最佳答案

一种方法是在您的 package.json 中创建一个脚本条目,如果它还不存在的话:

{
  ...
  "scripts": {
    "ng": "node_modules/.bin/ng",
    "start": "ng serve -o -lr=false"
  },
  ...
}

这将打开浏览器,并禁用实时重新加载(如果这是你想要的。如果不是,请删除 -lr 选项)。这也将使用本地安装的 angular-cli。这样就不用全局安装了

然后创建一个新的运行配置并选择 npm

  • 选择你的 package.json
  • 选择运行命令
  • 选择脚本开始

确保您的节点解释器已设置,然后按ok

现在您可以使用绿色按钮来运行您的配置:)

您也可以右键单击您的 package.json,然后选择 show npm scripts。这将打开一个窗口,您可以在其中双击刚刚创建的“启动”脚本

关于angular - 如何从 Intellij idea 2017.1 运行 Angular 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43994367/

相关文章:

javascript - 遍历类数组Angular4

c# - 身份验证失败,因为远程方在使用 https 时关闭了 localhost 中的传输流

intellij-idea - IntelliJ IDEA extractRepoFileDependencies错误中的Gradle错误

intellij-idea - 在 gradle 项目和 IntelliJ IDEA 项目中同步更改运行非常缓慢

git - 在 IntelliJ 中重构时如何将更改日志保存在 git 文件中?

mysql - 从Intellij的数据库工具连接到MySql Docker-Container

java - Checkstyle安装报错Intellij Idea

json - 无法使用 Angular 6 和 ASP.NET MVC5 加载本地数据

javascript - 将常规 JavaScript 变量附加到 Angular 2 模型(输入)?

javascript - 如何在 ionic 按钮组件中传递禁用条件