Skip to content

Extension fails to attach when updating from ns-cli 7.1 to 7.2 #283

Open

Description

@fraune

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 7.2.1
  • Cross-platform modules: tns-core-modules has 6.5.26
  • Android Runtime: 6.5.3
  • iOS Runtime: 6.5.4
  • Plugin(s): NativeScript 0.12.0 (plugin for VS code)
  • VSCode: 1.54.2

Describe the bug
VS Code giving the following error when trying to attach debugger: NativeScript CLI not found. Use 'nativescript.tnsPath' workspace setting to explicitly set the absolute path to the NativeScript CLI.. This doesn't seem to be a problem when I downgrade the CLI to 7.1.2, but the problem exists for me on CLI 7.2.*.

To Reproduce

  1. Update NativeScript CLI to latest (7.2.1) via npm i -g nativescript.
  2. Launch app via ns run --no-hmr
  3. While in the working folder in VS Code, attach on iOS

Expected behavior
Debugger should attach and set breakpoints should be hit.

Sample project
Not sharing at this time...

Additional context
I am working in a NativeScript 6 project with ns-cli 7, due to dependency package support problems. Never had trouble with the debugger until an update to ns-cli 7.2+.

Activity

  1. NathanWalker commented on Mar 15, 2021

    @NathanWalker
    Member

    @fraune out of curiosity, in VS Code plugin pane, can you choose the option next to the {N} plugin to install a specific version and choose 0.11.0 - I'd be curious if that prior version works for you in this case?

  2. self-assigned this
    on Mar 15, 2021
  3. fraune commented on Mar 15, 2021

    @fraune
    Author

    Tried installing another version (0.11.0) and got the following message:

    [2021-03-15 13:32:55.900] [renderer1] [error] Error: Unable to install extension 'nativescript.nativescript' as it is not compatible with VS Code '0.11.0'.
        at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1692:15746
        at async file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2431:94753
        at async T.run (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:171:30414)
        at async a.runAction (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1233:31224)
    

    I downloaded and installed the VSIX manually, and see the same error as before (NativeScript CLI not found. Use 'nativescript.tnsPath' workspace setting to explicitly set the absolute path to the NativeScript CLI.)

  4. NathanWalker commented on Mar 15, 2021

    @NathanWalker
    Member

    Ok good to know, thanks for confirming.

  5. fraune commented on Mar 16, 2021

    @fraune
    Author

    In case it helps, here's a little more information about my system:

    • Intel Mac running Big Sur (macOS 11.2.3)
    • zsh 5.8 (x86_64-apple-darwin20.0)
    • Node v14.16.0

    Let me know if there's any other information I can give to help replicate this behavior.

  6. NathanWalker commented on Mar 18, 2021

    @NathanWalker
    Member

    @fraune 0.12.3 has been published now, once updated please give it a try and lemme know.

  7. fraune commented on Mar 19, 2021

    @fraune
    Author

    Working now! Much appreciated.

  8. fraune commented on Mar 19, 2021

    @fraune
    Author

    This should probably be another issue, but after updating to macOS 11.2.3, my breakpoints haven't been gettin hit in VS Code and hovering over them gives me the following message:

    Breakpoint ignored because generated code not found (source map problem?).
    

    Have you had any trouble with attaching breakpoints in vscode or seen any other issues for this?

  9. dmedina2015 commented on Mar 21, 2021

    @dmedina2015

    Hi, I'm getting similar problem trying to debug a NS project with VSCode and nativescript-vscode-extension.

    Environment:
    MacOS: 11.2.2 (BigSur)
    VSCode: 1.54.3
    NS CLI: 7.2.1
    nativescript-vscode-extension: 0.12.3

    How to reproduce:
    (1) Create a brand new project using ns create foo
    (2) Create launch.json using instructions in this link
    (3) Plug phone (dev mode + usb debugging enabled) to the computer.
    (4) Run configuration "Launch on Android"

    Expected Behaviour
    App opens on phone and breakpoints are triggered in VSCode.

    Observed Behaviour

    • App starts on phone, but breakpoints are ignored. It seems that debugger is not even attaching to the app, because I'm not getting the [NSDebugAdapter] Connection to target application established on 40000 message in console. Last message in console is [NSDebugAdapter] Ready to attach to application on 40000.
    • I'm able to debug using Chrome device inspection. Breakpoints work well there.
    • Getting same behavior using Android Emulator
    • Last messages in console are:
    ...
    Project successfully built.
    The build result is located at: /Users/daniel/Documents/Workspace/onconetwork/nativeFront/platforms/android/app/build/outputs/apk/debug/app-debug.apk
    
    Installing on device 27236b14b71c7ece...
    
    Successfully installed on device with identifier '27236b14b71c7ece'.
    
    Restarting application on device 27236b14b71c7ece...
    
    # NativeScript Debugger started #
    
    device: 27236b14b71c7ece debug port: 40000
    
    
    To start debugging, open the following URL in Chrome:
    devtools://devtools/bundled/inspector.html?ws=localhost:40000
    
    
    Successfully synced application org.nativescript.nativeFront on device 27236b14b71c7ece.
    
    [NSDebugAdapter] Ready to attach to application on 40000
    
    
  10. fraune commented on Apr 9, 2021

    @fraune
    Author

    @NathanWalker The original issue I experienced was addressed with the 0.12.3 update. I opened a new issue for the breakpoint trouble I mentioned. Not sure what @dmedina2015 is experiencing, but I think the issue I opened could be marked as solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions