rafaelmaiolla / remote-vscode

A package that implements the Textmate's 'rmate' feature for Visual Studio Code.
MIT License
260 stars 33 forks source link

Error: Cannot find module 'vscode' #18

Closed kulak closed 7 years ago

kulak commented 7 years ago

It seems that extension does not work on latest (1.9.1 VSCode) version.

I tried to start it in debugger (I am not an expert) and got an error message:

Error: Cannot find module 'vscode'

I tried loading dependencies with

npm install

and it did not help. I passed one missing vscode error, but got another one that's similar:

"Error: Cannot find module 'vscode'    at Function.Module._resolveFilename (module.js:469:15)    at Function.Module._load (module.js:417:25)    at Module.require (module.js:497:17)    at require (internal/module.js:20:19)    at Object.<anonymous> (c:Userssgnezdov.vscodeextensionsafaelmaiolla.remote-vscode-1.0.0outsrcextension.js:2:16)    at Module._compile (module.js:570:32)    at Object.Module._extensions..js (module.js:579:10)    at Module.load (module.js:487:32)    at tryModuleLoad (module.js:446:12)    at Function.Module._load (module.js:438:3)"

The machine is not a real development box. I had to install node on it prior to testing it.

My launch.json looks like this:

{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${workspaceRoot}\\out\\src\\extension.js",
        "cwd": "${workspaceRoot}"
    },
    {
        "type": "node",
        "request": "attach",
        "name": "Attach to Process",
        "port": 5858
    }
]
}

Remote command was not working, so I started the debugging process and run into this error. It seems to make sense as I see no log messages when I try to start remote.

rafaelmaiolla commented 7 years ago

I will need to investigate it.

kulak commented 7 years ago

Please feel free to give me instructions to clarify the issue. I will find the time to help you in troubleshooting the issue.

rafaelmaiolla commented 7 years ago

I just tested here and it is working as expected.

My launch configuration is as follow, which is already included in the source code:

// A launch configuration that compiles the extension and then opens it inside a new window
{
    "version": "0.1.0",
    "configurations": [
        {
            "name": "Launch Extension",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
            "stopOnEntry": false,
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/out/src",
            "preLaunchTask": "npm"
        },
        {
            "name": "Launch Tests",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
            "stopOnEntry": false,
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/out/test",
            "preLaunchTask": "npm"
        }
    ]
}
kulak commented 7 years ago

Interesting. I decided to install remote on Linux dev VM and got the same problem. Only this time I tracked the details.

I opened extension directory and found no launch file. To preserve the state, I wrote down all the files I have with command:

find rafaelmaiolla.remote-vscode-1.0.1/ > find-rafaelmaiolla.remote-vscode-1.0.1-clean.txt

I then went to debugger and generated Node.js configuration from VSCode. I did not start debugger. I wrote down the file list:

find rafaelmaiolla.remote-vscode-1.0.1/ > find-rafaelmaiolla.remote-vscode-1.0.1-w-launch.txt

I run diff on the files and found that I now have a new .vscode directory.

I saved content of generated .vscode dir:

zip -r generated-launch.zip rafaelmaiolla.remote-vscode-1.0.1/.vscode/

See attached files:

find-rafaelmaiolla.remote-vscode-1.0.1-clean.txt find-rafaelmaiolla.remote-vscode-1.0.1-w-launch.txt generated-launch.zip

My VSCode reports the following version information:

Version 1.9.1
Commit f9d0c687ff2ea7aabd85fb9a43129117c0ecf519
Date 2017-02-08T23:44:55.542Z
Shell 1.4.6
Renderer 53.0.2785.143
Node 6.5.0

Output of uname -a

Linux setun 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

That Ubuntu 16.04 LTS that's almost up to date.

kulak commented 7 years ago

I replaced my launch.json content with yours and got error reports from VSCode for outDir parameter:

Attribute 'outDir' is deprecated.  Use 'outFiles' instead.

And I stopped on that.

rafaelmaiolla commented 7 years ago

That was updated to use outFiles.

Besides that, the extension was updated to 1.1.0. Could you please check if it is working now?

kulak commented 7 years ago

I forgot which machine or VM had an issue, so I tried to reproduce the issue from "scratch".

On Windows 10

I updated VS Code to latest 1.14.1.

I uninstalled possibly older version of "Remote VSCode". I did not try to verify local files content, because I am not sure what I am doing in this case.

I installed version 1.10.

Here is my settings.json file:

`// Place your settings in this file to overwrite the default settings { // Controls if opened editors should show in tabs or not. "workbench.editor.showTabs": true,

// Remote VSCode configuration (a.k.a. rmate)
"remote.port": 52698,
"remote.onstartup": true,
"window.zoomLevel": 0

}`

It worked.

I used default ports and "shell" version of rmate available on github.

Putty was configured with ports:

Source port: 5268
Destination: 127.0.0.1:52698 "Remote" radio button is selected.

rafaelmaiolla commented 7 years ago

Cool. I will close this issue.