簡體   English   中英

Visual Studio代碼不會在NativeScript應用程序中的斷點處停止

[英]Visual Studio Code won't stop at breakpoint in NativeScript app

我想使用nativescript創建一個小型的android應用程序,但是這樣做沒有調試器會使事情變得比它們要慢得多。 由於它只是一個JS應用程序,我決定嘗試使用Visual Studio Code,它至少在他們的教程視頻中看起來與NativeScript應用相當不錯,但是當我嘗試使用它時,它似乎並沒有停留在任何斷點。 這是我的VSC啟動配置:

    {
        "name": "Launch on Android",
        "type": "nativescript",
        "request": "launch",
        "platform": "android",
        "appRoot": "${workspaceRoot}",
        "sourceMaps": true,
        "watch": true,
        "tnsArgs": "--emulator"
    }

我注意到如果我添加"stopOnEntry": true對於這個配置是真的,應用程序實際上就像它應該停止一樣,但看起來VSC的調試器並沒有真正附加到進程,因為Play按鈕保持禁用狀態。

這是我的package.json

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "scripts": {
    "recreate": "rm -rf platforms && rm -rf node_modules && npm install && tns platform add android"
  },
  "nativescript": {
    "id": "org.nativescript.forni",
    "tns-android": {
      "version": "2.5.1"
    }
  },
  "dependencies": {
    "lodash": "^4.17.4",
    "nativescript-oauth": "^1.2.1",
    "nativescript-telerik-ui": "^1.5.1",
    "tns-core-modules": "2.4.4"
  },
  "devDependencies": {
    "babel-traverse": "6.21.0",
    "babel-types": "6.21.0",
    "babylon": "6.15.0",
    "lazy": "1.0.11"
  }
}

這是我的app.js,這是我希望打破的地方:

const application = require("application");
application.start({ moduleName: "views/login/login" });

我正在使用Windows 10.我也嘗試直接在我的三星Galaxy S7上運行應用程序,但它的工作方式完全相同。

在我的Win10機器上,我遇到了類似的問題。 看起來,調試器已經附加到最近。 您可以通過添加觸發函數的按鈕來檢查並在該函數內設置斷點。 它應該在按下按鈕后工作。

要解決此問題,請嘗試在launch.json文件中的tnsArgs中添加--debug-brk選項:

 {
      "name": "Launch on Android",
      "type": "nativescript",
      "request": "launch",
      "platform": "android",
      "appRoot": "${workspaceRoot}",
      "sourceMaps": true,
      "watch": true,
      "stopOnEntry": false,
      "tnsArgs": ["--debug-brk"]
    }

文檔: https//docs.nativescript.org/tooling/debugging/debugging

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM