Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fraune opened this issue Mar 15, 2021 · 9 comments
Open

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

fraune opened this issue Mar 15, 2021 · 9 comments
Assignees

Comments

@fraune
Copy link

fraune commented Mar 15, 2021

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+.

@NathanWalker
Copy link
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?

@fraune
Copy link
Author

fraune commented Mar 15, 2021

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.)

@NathanWalker
Copy link
Member

Ok good to know, thanks for confirming.

@fraune
Copy link
Author

fraune commented Mar 16, 2021

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.

@NathanWalker
Copy link
Member

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

@fraune
Copy link
Author

fraune commented Mar 19, 2021

Working now! Much appreciated.

@fraune
Copy link
Author

fraune commented Mar 19, 2021

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?

@dmedina2015
Copy link

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

@fraune
Copy link
Author

fraune commented Apr 9, 2021

@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
Projects
None yet
Development

No branches or pull requests

3 participants