Part 2: Running Monaca Debugger with Monaca CLI¶
Table of Contents
Monaca Debugger is a powerful application for testing and debugging your Monaca applications on real devices in real time.
When developing Monaca apps on your local PC, assuming that your local PC is successfully paired with Monaca Debugger, all changes made to your project files will be pushed into your Monaca Debugger as soon as you save those changes.
Please install Monaca Debugger on your device.
Please refer to Monaca Debugger Installation for other platforms.
In order to debug/test a local Monaca app, you need to pair local PC with Monaca Debugger.
Before connecting Monaca Debugger to the local PC, please pay attention to the following points:
- Monaca Debugger and the local PC have to connect to the same network connection (LAN or Wi-Fi).
- Use the same Monaca account for either Monaca Debugger and the local PC.
- Disable the local PC’s firewall.
- In the command window, navigate to your project folder and type monaca debug command to connect to your Monaca Debugger. Then, Monaca CLI will wait for requests from debugger.
- Launch Monaca Debugger app and sign in using your Monaca account information. Make sure you are using the same account information you use for Monaca CLI earlier.
- Then, a popup message prompting you to pair the debugger with the local PC will appear.
- If your pairing is successful, your local project name will appear under
Local Projectsin Monaca Debugger. However, if you fail the pairing, please refer to Fail to Pair Monaca Debugger.
- From the Local Projects list in Monaca Debugger, click on your project name to run it.
- Now the project should be running as shown in the screenshot below. Use Back button within Debugger Menu button to go back to the Project List screen.
- Run the project on the debugger.
- You can now try making some changes to your file. For example, try changing the starting page of the sample app to Page 2. In order to do this, please open the
index.htmlfile. Then, change the
page2.htmland save your changes. The updated code should look like this:
... <ons-sliding-menu var="app.slidingMenu" menu-page="menu.html" main-page="page2.html" side="left" type="overlay" max-slide-distance="200px"> </ons-sliding-menu> ...
- If your PC is still connected to Monaca Debugger, it will automatically refresh the updates. Now your starting page should be Page 2.