简体   繁体   中英

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?

From terminal I just put ng serve but what should I select from list of configurations from Intellij Idea?

One way to do it is to create a scripts entry in your package.json , if it's not already there:

{
  ...
  "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). This will also use a locally installed angular-cli . This way you don't have to install it globally

Then create a new run configuration and choose npm .

  • Select your package.json
  • Select run command
  • Select the script start

Make sure your node interpreter is set, and press 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 . This will open a window, where you can double click the 'start' script you just created

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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