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

Error: Cannot find module '/Users/drew.wyatt/Projects/Nativescript/typescript-test/ios' #117

Closed drewwyatt closed 6 years ago

drewwyatt commented 7 years ago

Steps to Reproduce

Expected Results

Actual Results

Additional Notes

It appears that it is running the command node debug ios --no-client --watch (instead of tns debug ...).

OS: macOS Sierra Version 10.12.3

Nativescript VSCode Extension Version: 0.6.1

$ tns --version
2.5.1
$ node -v
v7.2.1

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch on iOS",
            "type": "nativescript",
            "request": "launch",
            "platform": "ios",
            "appRoot": "${workspaceRoot}",
            "sourceMaps": true,
            "watch": true
        },
        {
            "name": "Attach on iOS",
            "type": "nativescript",
            "request": "attach",
            "platform": "ios",
            "appRoot": "${workspaceRoot}",
            "sourceMaps": true,
            "watch": false
        },
        {
            "name": "Launch on Android",
            "type": "nativescript",
            "request": "launch",
            "platform": "android",
            "appRoot": "${workspaceRoot}",
            "sourceMaps": true,
            "watch": true
        },
        {
            "name": "Attach on Android",
            "type": "nativescript",
            "request": "attach",
            "platform": "android",
            "appRoot": "${workspaceRoot}",
            "sourceMaps": true,
            "watch": false
        }
    ]
}

Debug Console Output from "Launch on iOS"

[NativeScriptCli] execute: node --version
[NSDebugAdapter] Using tns CLI vNaN.2.1 on path 'node'
[NSDebugAdapter] Running tns command...
[NativeScriptCli] execute: node debug ios --no-client --watch 
[NSDebugAdapter] Watching the tns CLI output to receive a connection token
debug> 

< Debugger listening on 127.0.0.1:5858
debug> 
connecting to 127.0.0.1:5858 ..
.
 ok
debug> 
< module.js:472
<     throw err;
<     ^
< Error: Cannot find module '/Users/drew.wyatt/Projects/Nativescript/typescript-test/ios'
<     at Function.Module._resolveFilename (module.js:470:15)
<     at Function.Module._load (module.js:418:25)
<     at Timeout.Module.runMain [as _onTimeout] (module.js:605:10)
<     at ontimeout (timers.js:365:14)
<     at tryOnTimeout (timers.js:237:5)
<     at Timer.listOnTimeout (timers.js:207:5)
debug> 
program terminated
debug> 

package.json

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.typescripttest",
    "tns-ios": {
      "version": "2.5.0"
    },
    "tns-android": {
      "version": "2.5.0"
    }
  },
  "dependencies": {
    "nativescript-theme-core": "~1.0.2",
    "tns-core-modules": "2.5.1"
  },
  "devDependencies": {
    "babel-traverse": "6.23.1",
    "babel-types": "6.23.0",
    "babylon": "6.15.0",
    "lazy": "1.0.11",
    "nativescript-dev-android-snapshot": "^0.*.*",
    "nativescript-dev-typescript": "^0.3.7",
    "typescript": "2.1.6"
  }
}
pkoleva commented 7 years ago

Hey, @drewwyatt,

I tried your exact steps on my machine but I couldn't reproduce it. From your output I can only guess why tns command is replaced with node command - one possible reason is if some symlinks are not ok. A way to be sure a specific tns installation will be used is if you set it up in your launch.json configurations -> just add "nativescriptCliPath": "///" to each configuration - we use it for local installations of the CLI. If this doesn't help try upgrading to the latest versions of the CLI and the extension. Hope one of these will work for you. Write back if not.

Thanks!

Plamen5kov commented 6 years ago

closing due to inactivity