microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.39k stars 28.62k forks source link

Remote terminals don't resolve variables when restored on startup #81231

Open andyj513 opened 4 years ago

andyj513 commented 4 years ago

Issue Type: Bug

I changed my Terminal->Integrated: Cwd setting to "$(workspaceFolder)". Now, when Code starts up, the Terminal does not open, and I get a notification: "The terminal shell CWD "/home/gpudb/gpudb-dev-7.0/gpudb-core/gaiadb-cluster/${workspaceFolder}" does not exist". This happens every time I launch Code.

However, once Code has loaded, I can then do Ctrl-` to open a Terminal window, and it works as expected (also every time). Note that this is doing Remote development (so the Terminal is opening a session on my remote machine).

I suspect the issue is that Code is trying to start the Terminal before $workspaceFolder is set, but it is set later, when I manually open the Terminal. It is a fairly easy work-around, but am reporting it in case this is not the expected behavior.

VS Code version: Code 1.38.1 (b37e54c98e1a74ba89e03073e5a3761284e3ffb0, 2019-09-11T13:35:15.005Z) OS version: Windows_NT x64 10.0.18362 Remote OS version: Linux x64 4.15.0-62-generic

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (8 x 2592)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.76GB (7.51GB free)| |Process Argv|| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|SSH: andy-linux| |OS|Linux x64 4.15.0-62-generic| |CPUs|Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 900)| |Memory (System)|62.86GB (6.62GB free)| |VM|0%|
Extensions (20) Extension|Author (truncated)|Version ---|---|--- vscode-cudacpp|kri|0.1.1 remote-containers|ms-|0.74.0 remote-ssh|ms-|0.46.1 remote-ssh-edit|ms-|0.46.1 remote-ssh-explorer|ms-|0.46.1 remote-wsl|ms-|0.39.5 vscode-remote-extensionpack|ms-|0.17.0 vs-keybindings|ms-|0.2.0 code-gnu-global|aus|0.2.2 githistory|don|0.4.6 mssql|ms-|1.6.0 cpptools|ms-|0.25.1 java|red|0.49.0 vscodeintellicode|Vis|1.1.9 vscode-java-debug|vsc|0.21.0 vscode-java-dependency|vsc|0.5.1 vscode-java-pack|vsc|0.8.0 vscode-java-test|vsc|0.19.0 vscode-maven|vsc|0.19.0 gitblame|wad|3.0.1
Tyriar commented 4 years ago

Nice find, looks like we're trying to resolve variables before the service that does it is able to do so.

lifez commented 4 years ago

@Tyriar I would like to take this. Could you please guide me?

Tyriar commented 4 years ago

@lifez this one will need you to do a bit of debugging/investigation here:

https://github.com/microsoft/vscode/blob/06f94fb46c12fdb4095cf18a4a35068fc8d9e9d8/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts#L193-L204

I think that if statement is not entered on launch because configurationResolverService is undefined.

lifez commented 4 years ago

@Tyriar Thank you!! I would like to take this one

lifez commented 4 years ago

@Tyriar I cannot start the code. Could you please help me please?

➜  scripts git:(fix-terminal-startup) ./code.sh
yarn run v1.17.0
$ node build/lib/electron
✨  Done in 1.19s.
[07:16:02] Syncronizing built-in extensions...
[07:16:02] You can manage built-in extensions with the --builtin flag
[07:16:02] [marketplace] ms-vscode.node-debug@1.38.8 ✔︎
[07:16:02] [marketplace] ms-vscode.node-debug2@1.39.1 ✔︎
[07:16:02] [marketplace] ms-vscode.references-view@0.0.30 ✔︎
Error: The module '/Users/phawin/mine/vscode/node_modules/spdlog/build/Release/spdlog.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func (electron/js2c/asar.js:138:31)
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
    at Object.func (electron/js2c/asar.js:138:31)
    at Object.func [as .node] (electron/js2c/asar.js:138:31)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at bindings (/Users/phawin/mine/vscode/node_modules/spdlog/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/Users/phawin/mine/vscode/node_modules/spdlog/index.js:3:35)
    at Module._compile (internal/modules/cjs/loader.js:786:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at NodeScriptLoader.load (/Users/phawin/mine/vscode/out/vs/loader.js:747:39)
    at OnlyOnceScriptLoader.load (/Users/phawin/mine/vscode/out/vs/loader.js:585:32)
    at loadNextPath (/Users/phawin/mine/vscode/out/vs/loader.js:1523:41)
    at Object.errorback (/Users/phawin/mine/vscode/out/vs/loader.js:1531:25)
    at OnlyOnceScriptLoader.triggerErrorback (/Users/phawin/mine/vscode/out/vs/loader.js:598:36)
    at /Users/phawin/mine/vscode/out/vs/loader.js:585:151
    at ReadFileContext.callback (/Users/phawin/mine/vscode/out/vs/loader.js:764:25)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:246:13) {
  phase: 'loading',
  moduleId: 'spdlog',
  neededBy: [ '===anonymous2===' ]
}
[main 2019-10-18T00:16:03.374Z] update#ctor - updates are disabled as there is no update URL
[main 2019-10-18T00:16:03.590Z] [storage state.vscdb] open(): Unable to open DB due to Error: The module '/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/build/Release/sqlite.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
[main 2019-10-18T00:16:03.609Z] [storage state.vscdb] open(): Unable to use backup due to Error: ENOENT: no such file or directory, unlink '/Users/phawin/Library/Application Support/code-oss-dev/User/globalStorage/state.vscdb'
[main 2019-10-18T00:16:03.610Z] [uncaught exception in main]: Error: The module '/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/build/Release/sqlite.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
[main 2019-10-18T00:16:03.610Z] Error: The module '/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/build/Release/sqlite.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func (electron/js2c/asar.js:138:31)
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
    at Object.func (electron/js2c/asar.js:138:31)
    at Object.func [as .node] (electron/js2c/asar.js:138:31)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/lib/sqlite3.js:1:15)
    at Module._compile (internal/modules/cjs/loader.js:786:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at NodeScriptLoader.load (/Users/phawin/mine/vscode/out/vs/loader.js:747:39)
    at OnlyOnceScriptLoader.load (/Users/phawin/mine/vscode/out/vs/loader.js:585:32)
    at loadNextPath (/Users/phawin/mine/vscode/out/vs/loader.js:1523:41)
    at Object.errorback (/Users/phawin/mine/vscode/out/vs/loader.js:1531:25)
    at OnlyOnceScriptLoader.triggerErrorback (/Users/phawin/mine/vscode/out/vs/loader.js:598:36)
    at /Users/phawin/mine/vscode/out/vs/loader.js:585:151
    at ReadFileContext.callback (/Users/phawin/mine/vscode/out/vs/loader.js:764:25)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:246:13)
[main 2019-10-18T00:16:03.610Z] Error: The module '/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/build/Release/sqlite.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func (electron/js2c/asar.js:138:31)
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
    at Object.func (electron/js2c/asar.js:138:31)
    at Object.func [as .node] (electron/js2c/asar.js:138:31)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/lib/sqlite3.js:1:15)
    at Module._compile (internal/modules/cjs/loader.js:786:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at NodeScriptLoader.load (/Users/phawin/mine/vscode/out/vs/loader.js:747:39)
    at OnlyOnceScriptLoader.load (/Users/phawin/mine/vscode/out/vs/loader.js:585:32)
    at loadNextPath (/Users/phawin/mine/vscode/out/vs/loader.js:1523:41)
    at Object.errorback (/Users/phawin/mine/vscode/out/vs/loader.js:1531:25)
    at OnlyOnceScriptLoader.triggerErrorback (/Users/phawin/mine/vscode/out/vs/loader.js:598:36)
    at /Users/phawin/mine/vscode/out/vs/loader.js:585:151
    at ReadFileContext.callback (/Users/phawin/mine/vscode/out/vs/loader.js:764:25)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:246:13) {
  phase: 'loading',
  moduleId: 'vscode-sqlite3',
  neededBy: [ '===anonymous3===' ]
}
[main 2019-10-18T00:16:03.711Z] [uncaught exception in main]: Error: The module '/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/build/Release/sqlite.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
[main 2019-10-18T00:16:03.712Z] Error: The module '/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/build/Release/sqlite.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func (electron/js2c/asar.js:138:31)
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
    at Object.func (electron/js2c/asar.js:138:31)
    at Object.func [as .node] (electron/js2c/asar.js:138:31)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/lib/sqlite3.js:1:15)
    at Module._compile (internal/modules/cjs/loader.js:786:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at NodeScriptLoader.load (/Users/phawin/mine/vscode/out/vs/loader.js:747:39)
    at OnlyOnceScriptLoader.load (/Users/phawin/mine/vscode/out/vs/loader.js:585:32)
    at loadNextPath (/Users/phawin/mine/vscode/out/vs/loader.js:1523:41)
    at Object.errorback (/Users/phawin/mine/vscode/out/vs/loader.js:1531:25)
    at OnlyOnceScriptLoader.triggerErrorback (/Users/phawin/mine/vscode/out/vs/loader.js:598:36)
    at /Users/phawin/mine/vscode/out/vs/loader.js:585:151
    at ReadFileContext.callback (/Users/phawin/mine/vscode/out/vs/loader.js:764:25)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:246:13)
[8392:1018/071606.782439:INFO:CONSOLE(17)] "Error: The module '/Users/phawin/mine/vscode/node_modules/spdlog/build/Release/spdlog.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).", source: file:///Users/phawin/mine/vscode/out/vs/platform/log/node/spdlogService.js (17)
[8392:1018/071606.793418:INFO:CONSOLE(17)] "Error: The module '/Users/phawin/mine/vscode/node_modules/spdlog/build/Release/spdlog.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).", source: file:///Users/phawin/mine/vscode/out/vs/platform/log/node/spdlogService.js (17)
[8392:1018/071606.793480:INFO:CONSOLE(17)] "Error: The module '/Users/phawin/mine/vscode/node_modules/spdlog/build/Release/spdlog.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).", source: file:///Users/phawin/mine/vscode/out/vs/platform/log/node/spdlogService.js (17)
[8392:1018/071606.801727:INFO:CONSOLE(138)] "Uncaught (in promise) Error: Module did not self-register.", source: electron/js2c/asar.js (138)
[8392:1018/071606.811598:INFO:CONSOLE(99)] "Uncaught (in promise) Canceled: Canceled", source: file:///Users/phawin/mine/vscode/out/vs/base/common/errors.js (99)
[main 2019-10-18T00:21:34.614Z] Error: The module '/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/build/Release/sqlite.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func (electron/js2c/asar.js:138:31)
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
    at Object.func (electron/js2c/asar.js:138:31)
    at Object.func [as .node] (electron/js2c/asar.js:138:31)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/Users/phawin/mine/vscode/node_modules/vscode-sqlite3/lib/sqlite3.js:1:15)
    at Module._compile (internal/modules/cjs/loader.js:786:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at NodeScriptLoader.load (/Users/phawin/mine/vscode/out/vs/loader.js:747:39)
    at OnlyOnceScriptLoader.load (/Users/phawin/mine/vscode/out/vs/loader.js:585:32)
    at loadNextPath (/Users/phawin/mine/vscode/out/vs/loader.js:1523:41)
    at Object.errorback (/Users/phawin/mine/vscode/out/vs/loader.js:1531:25)
    at OnlyOnceScriptLoader.triggerErrorback (/Users/phawin/mine/vscode/out/vs/loader.js:598:36)
    at /Users/phawin/mine/vscode/out/vs/loader.js:585:151
    at ReadFileContext.callback (/Users/phawin/mine/vscode/out/vs/loader.js:764:25)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:246:13) {
  phase: 'loading',
  moduleId: 'vscode-sqlite3',
  neededBy: [ '===anonymous3===' ]
}
Tyriar commented 4 years ago

@lifez that means the node modules are using a different version of Electron that what's running, we recently changed the version fo Electron from 6->4->6. You should

lifez commented 4 years ago

I cannot make this work. I think it because Catalina https://github.com/nodejs/node-gyp/issues/1927

So that I won't work on this issue.

ChrisPapp commented 4 years ago

I cannot reproduce it on Windows 10. Maybe this thread should be closed, if the issue has already been fixed.

JoyceBabu commented 4 years ago

I am also getting similar error

Error: The module '\?\D:\Projects\code-server\build\lib\vscode\node_modules\spdlog\build\Release\spdlog.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 75. This version of Node.js requires NODE_MODULE_VERSION 72. Please try re-compiling or re-installing

Tyriar commented 4 years ago

@JoyceBabu try recompiling as in https://github.com/microsoft/vscode/issues/81231#issuecomment-543799165, we change the Electron version sometimes which means all native node modules will stop working until you do that.

andyj513 commented 4 years ago

Minor correction: ”not only on launch" – remove the “not”. The issue I saw was only a problem when the Terminal was opening on Launch. But once Code and completed launching, I was able to successfully open a terminal with the setting.

I haven’t tried this recently, since I changed my setting to work-around this issue. If you are unable to repro, I can try again with the latest build.

From: Daniel Davis notifications@github.com Sent: Tuesday, June 16, 2020 4:19 PM To: microsoft/vscode vscode@noreply.github.com Cc: Andy Jacobs ajacobs@kinetica.com; Author author@noreply.github.com Subject: Re: [microsoft/vscode] Terminal window doesn't open at startup (#81231)

@Tyriar https://github.com/Tyriar I wouldn't mind taking a shot at this, but just want to confirm that I've understood the bug properly. If I set my Terminal -> Integrated Cwd setting to ${workspaceFolder}, my terminal never loads and always throws an error, not only on launch, but it sounds like the issue being reported is exclusive to launch/startup. Let me know if I'm misunderstanding.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/81231#issuecomment-644990200 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYOGSWTFHYEAYVLFPZ6KE3RW7HTJANCNFSM4IYXM37A . https://github.com/notifications/beacon/ABYOGSQDZYXLJDPWGLYPOSDRW7HTJA5CNFSM4IYXM37KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEZY4J6A.gif

Tyriar commented 4 years ago

@andyj513 I suspect this is still happening.