Angular2 Npm Commands



npm start // Start a local development web server. This will create a local web 
  server that is listening to port 8000 on your local machine. You can now 
  browse to the application at http://localhost:8000/index.html. To serve the 
  web app on a different IP address or port, edit the "start" script within 
  package.json. You can use -a to set the address and -p to set the port. You 
  also need to update the baseUrl configuration property in 

npm test // Start the Karma unit test runner. This will start the Karma unit 
  test runner. Karma will read the configuration file karma.conf.js, located at 
  the root of the project directory. This configuration file tells Karma to:

  1. Open up instances of the Chrome and Firefox browsers and connect them to 
  2. Execute all the unit tests in these browsers.
  3. Report the results of these tests in the terminal/command line window.
  4. Watch all the project's JavaScript files and re-run the tests whenever any 
     of these change.
  5. It is good to leave this running all the time, in the background, as it 
     will give you immediate feedback about whether your changes pass the unit 
     tests while you are working on the code.

npm run protractor // Run the Protractor end-to-end (E2E) tests. We use E2E 
  (end-to-end) tests to ensure that the application as a whole operates as 
  expected. E2E tests are designed to test the whole client-side application, 
  in particular that the views are displaying and behaving correctly. It does 
  this by simulating real user interaction with the real application running in 
  the browser. The E2E tests are kept in the e2e-tests directory. The 
  angular-phonecat project is configured to use Protractor to run the E2E tests 
  for the application. Protractor relies upon a set of drivers to allow it to 
  interact with the browser. You can install these drivers by running: npm run 
  update-webdriver. You don't have to manually run this command. Our npm scripts 
  are configured so that it will be automatically executed as part of the 
  command that runs the E2E tests.

npm run update-webdriver // Install the drivers needed by Protractor.

webdriver-manager start // start the WebDriver / Selenium server

When we run the 'npm install' command the very first time, this command reads 
the package.json file and downloads the following tools into the node_modules 

1. Bower: a client-side code package manager
2. Http-Server: simple local static web server
3. Karma: a unit test runner
4. Protractor: an end-to-end (E2E) test runner

Running npm install will also automatically use bower to download the AngularJS 
framework into the app/bower_components directory.

python -m SimpleHTTPServer // start the local server
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License