[英]How to run angular app from Intellij idea 2017.1?
How can I set run my angular 2 application from Intellij Idea run configuration menu? 如何从Intellij Idea运行配置菜单中设置运行我的角度2应用程序?
From terminal I just put ng serve
but what should I select from list of configurations from Intellij Idea? 从终端我只是ng serve
但我应该从Intellij Idea的配置列表中选择什么?
One way to do it is to create a scripts entry in your package.json
, if it's not already there: 一种方法是在package.json
创建一个脚本条目,如果它尚未存在:
{
...
"scripts": {
"ng": "node_modules/.bin/ng",
"start": "ng serve -o -lr=false"
},
...
}
This will open the browser, and disable live-reloading (if that's what you would like.. If not, remove the -lr
option). 这将打开浏览器,并禁用实时重新加载(如果这是您想要的...如果不是,请删除-lr
选项)。 This will also use a locally installed angular-cli
. 这也将使用本地安装的angular-cli
。 This way you don't have to install it globally 这样您就不必全局安装它
Then create a new run configuration and choose npm
. 然后创建一个新的运行配置并选择npm
。
start
选择脚本start
Make sure your node interpreter is set, and press ok
. 确保已设置节点解释器,然后按ok
。
Now you can use the green button to run your configuration :) 现在您可以使用绿色按钮来运行配置:)
You can also just right-click on your package.json
, and select show npm scripts
. 您也可以右键单击package.json
,然后选择show npm scripts
。 This will open a window, where you can double click the 'start' script you just created 这将打开一个窗口,您可以在其中双击刚刚创建的“开始”脚本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.