nativescript-community / nativescript-vscode-extension

A Visual Studio Code Extension for NativeScript
https://www.nativescript.org/visual-studio-code
Apache License 2.0
82 stars 32 forks source link

Debugger errors out with ts_helpers.js not found and crashes on file change #210

Open KirilOkun opened 5 years ago

KirilOkun commented 5 years ago

When trying to run debugger in VSC with stopOnEntry: true debugger throws the following error and stops.

Unable to open 'ts_helpers.js': File not found (file:///data/data/com.appxxx/files/internal/ts_helpers.js).

I’m not sure where this path is set so i looked in the file systems and found a couple of similar folders

/home/xxx/dev/appxxx/platforms/android/app/build/intermediaries/assets/debug/internal /home/xxx/dev/appxxx/platforms/android/app/src/main/assets/internal

When VSC shows the error it also offers to create the missing file. When clicked it also errors out with the “Permissions denied” error.

I’ve changed permissions on the above folders and contained files to 777 (wide open to all) but with the same result.

If i ignore the error messages above and attempt to walk through the application in debugger it works one time but throws bundle.js not found error. Searching for that file yield the following folders

/home/zzz/dev/appxxx/platforms/android/app/build/intermediates/assets/debug/app/bundle.js /home/zzz/dev/appxxx/platforms/android/app/src/main/assets/app/bundle.js

changing file permissions to 777 does not change anything.

Any file change reloads the app but then the application crashes on topmost().currentEntry being null, which is strange because it works fine the first time through. So at this point debugger has to be shutdown and restarted on every change since it doesn't work with livesync.

Debugger worked fine until recently. Not sure what happened to change that but now it does slow down development a great deal.

launch.json

        {
            "name": "Launch on Android",
            "type": "nativescript",
            "request": "launch",
            "platform": "android",
            "appRoot": "${workspaceRoot}",
            "sourceMaps": true,
            // "stopOnEntry": true,
            "watch": true,
            "sourceMapPathOverrides": {
                "webpack:///*": "${workspaceRoot}/app/*"
            },
            "tnsArgs": [
            "--bundle",
            "--debug-brk",
            "--emulator"
            ]
        },

package.json

{
  "name": "xxxxx",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "version": "0.1.0",
  "nativescript": {
    "id": "xxxxxr",
    "tns-android": {
      "version": "4.2.0"
    }
  },
  "scripts": {
    "lint": "tslint \"app/**/*.ts\""
  },
  "dependencies": {
    "moment": "^2.22.2",
    "nativescript": "^4.2.4",
    "nativescript-cardview": "^3.1.0",
    "nativescript-checkbox": "^3.0.3",
    "nativescript-doorbell.io": "0.0.3",
    "nativescript-feedback": "^1.1.2",
    "nativescript-plugin-firebase": "^7.1.0",
    "nativescript-purchase": "^2.0.5",
    "nativescript-theme-core": "^1.0.4",
    "nativescript-ui-dataform": "^3.5.2",
    "nativescript-ui-listview": "^3.5.4",
    "nativescript-ui-sidedrawer": "^3.5.2",
    "tns-core-modules": "^4.2.1"
  },
  "devDependencies": {
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "lazy": "1.0.11",
    "nativescript-dev-sass": "^1.6.0",
    "nativescript-dev-typescript": "^0.7.4",
    "nativescript-dev-webpack": "^0.15.1",
    "tslint": "5.8.0",
    "typescript": "^3.1.1"
  }
}

webpack.config.js is generated by the nativescript-dev-webpack and there are no customizations.

KirilOkun commented 5 years ago

Correction. The debugger doesn't stop on file change but rather on application error. This requires debugging session restart, which is not optimal. After all the reason we're debugging is to fix the errors. If we didn't have errors there would be no need for debugging.

But the "ts_helpers.js not found" error comes up every time the debugger is restarted. Would you please look into that? I've searched far and wide for a solution but nothing. Any pointer to where the problem might be will be greatly appreciated.

clintwood commented 5 years ago

I'm getting the same issue as above (files not being found, ts_helpers.js, vendor.js, bundle.js, etc) however when debugging using chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:40000 the files are found without problem and debugging works 100%.