Reputation: 3302
I am trying to build an Angular 2 application using VSCode editor. On my machine the default browser is IE. When I run npm start
it launches the application in IE. But I want to launch my application in Chrome.
How can I change this behaviour to launch Chrome instead of IE with npm start
?
Upvotes: 3
Views: 14647
Reputation: 89
Just go to Google chrome setting -> go to default browser(see on left side) -> click on make default -> then search web browser click on web browser you see chrome just click (you see chrome is default browser now)-> then Run your command ng s -o
Upvotes: -2
Reputation: 1464
You could try it using package.json
, as a workaround for default browser. Look into the "scripts"
and find "start"
. Use this code snippet:
"start": "start {browser} http://{projectsite} && ng serve"
With {browser}
as your preferred browser (in this case, use chrome
), and {projectsite}
as the site where the application is started (if you haven't changed any of the setting for the test, still use localhost:4200
).
If you want to test it, use npm start
to run these commands. It should start the browser first before compiling the angular project so you would see a "page not found" before switching to your app.
Upvotes: 3
Reputation: 11
To do so, go to the Run view (Ctrl+Shift+D) and click on the gear button to create a launch. json debugger configuration file. Choose Chrome from the Select Environment drop-down list. This will create a launch.
Upvotes: 1
Reputation: 21
If you're using VS_Code as your IDE then go to .vs > vscode > launch.json
in that check for the below.
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:PortNo",
"webRoot": "${workspaceFolder}",
}
Upvotes: 2