Skip to content
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

Node modules are looked up in global paths #68024

Closed
ModernWebService opened this issue Feb 7, 2019 · 18 comments
Closed

Node modules are looked up in global paths #68024

ModernWebService opened this issue Feb 7, 2019 · 18 comments
Assignees
Labels
extension-host Extension host issues
Milestone

Comments

@ModernWebService
Copy link

ModernWebService commented Feb 7, 2019

  • VSCode Version: Version 1.31.0 (1.31.0)
  • OS Version: MacOS Mojave

I had an update notification pop up which I did not realize it was going to run when I closed my editor and then re-opened it shortly after. Since the latest released up, all my extensions will not run and on start up i get "Extension host terminated unexpectedly."
screen shot 2019-02-06 at 21 27 30

No matter how many times I click restart extension host it continues showing the failed message.

To clarify when this happened to me I was using 1.30 and restarted VSCode got the prompt for the January Changes skimmed it and then started noticing that no plugins were working.

  • Restarted a few times and got the screenshotted prompt above.
  • Tried restarted my laptop and then getting back in vscode
  • Checked if there was another update after to fix it
  • Then decided to re-install vscode while using another editor/terminal to ssh into a server to deploy the project I was working on when this happened

Since the re-install I do believe all my extensions are working as expect and do not believe I removed any. Most of my extensions are Larave, PHP, 1 or 2 Python, couple RoR, and then some Node/angular.

@vscodebot vscodebot bot added the new release label Feb 7, 2019
@ModernWebService
Copy link
Author

ModernWebService commented Feb 7, 2019

Some of the errors thrown

dyld: lazy symbol binding failed: Symbol not found:
dyld: Symbol not found:

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:3362

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:4634 Overwriting grammar scope name to file mapping for scope source.js.
Old grammar file: file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/extensions/javascript/syntaxes/JavaScript.tmLanguage.json.

@ModernWebService
Copy link
Author

Re-installed vscode and extensions appear to be working again. But this did break extensions on my old install

@tkhwang
Copy link

tkhwang commented Feb 7, 2019

I've got the same problem with the latest vscode.
I'm not sure, but it seems that it is same as before.. that of @ModernWebService.

I just share it again.
Log message after pressing Open Developer Tools in Extension host terminated unexpectedly popup.

At first

[Extension Host] debugger listening on port 50687

Repeated for several plugins.

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:4634 Overwriting grammar scope name to file mapping for scope source.sql.
Old grammar file: file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/extensions/sql/syntaxes/sql.tmLanguage.json.
New grammar file: file:///Users/tkhwang/.vscode/extensions/jakebathman.mysql-syntax-1.3.1/syntaxes/MySQL.tmLanguage

... repeated

Extension Host
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:3362 
Debugger listening on ws://127.0.0.1:50687/2294b3d3-2cd3-494e-b84f-c8902faf76fa
For help, see: https://nodejs.org/en/docs/inspector

SIGABRT

Extension host terminated unexpectedly. Code:  null  Signal:  SIGABRT
t._onExtensionHostCrashed @ extensionService.ts:457

Extension host terminated unexpectedly.
t.onDidNotificationChange @ notificationsAlerts.ts:40
extensionHost.ts:231 Extension Host
extensionHost.ts:232 dyld: lazy symbol binding failed: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
  Referenced from: /Users/tkhwang/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
  Referenced from: /Users/tkhwang/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node
  Expected in: flat namespace

@alexdima
Copy link
Member

alexdima commented Feb 7, 2019

@ModernWebService @tkhwang Does this reproduce if you disable all extensions? (Most likely you have an extension installed that is causing this). You can also look for the extension host log to see which extension was being loaded when the crash occured. (F1 > Developer: Show Logs... > Extension Host).

With this stable release, we have updated our Electron version and if you are using any extension that uses native node modules, it will stop working and could cause extension host crashes.

@alexdima alexdima added the info-needed Issue requires more information from poster label Feb 7, 2019
@tkhwang
Copy link

tkhwang commented Feb 7, 2019

@alexandrudima , As I checked, the crash dosn't occur after uninstalling the following plugin as you said.

VS Code for Node.js - Development Pack
https://marketplace.visualstudio.com/items?itemName=nodesource.vscode-for-node-js-development-pack

You may reproduce after installing this plugin, I guess.

(update) Actually the above plugin consists of a lot of plugins. As I tested, the crash dosn't occur after installing each of them. The crash only occurs after installing the the plugin itself.

(update2) I found another plugin which crashes.

Settings Sync
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync

@renarsvilnis
Copy link

screenshot 2019-02-07 at 14 01 10

Tried reinstall trough brew, didn't help.

Text version:

``` [Extension Host] debugger listening on port 29729 extensionHost.ts:231 Extension Host extensionHost.ts:232 Debugger listening on ws://127.0.0.1:29729/cdf2c22a-577b-4491-b25a-e85569d055d4 For help, see: https://nodejs.org/en/docs/inspector

extensionHost.ts:231 Extension Host
extensionHost.ts:232 dyld: lazy symbol binding failed: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
Referenced from: /Users/renarsvilnis/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node
Expected in: flat namespace

dyld: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
Referenced from: /Users/renarsvilnis/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node
Expected in: flat namespace

log.ts:161 INFO no standard startup: not a new window
extensionService.ts:457 Extension host terminated unexpectedly. Code: null Signal: SIGABRT
t._onExtensionHostCrashed @ extensionService.ts:457
(anonymous) @ extensionService.ts:451
e.fire @ event.ts:567
t._onExtHostProcessExit @ extensionHost.ts:487
(anonymous) @ extensionHost.ts:246
emit @ events.js:182
ChildProcess._handle.onexit @ internal/child_process.js:237
notificationsAlerts.ts:40 Extension host terminated unexpectedly.
t.onDidNotificationChange @ notificationsAlerts.ts:40
(anonymous) @ notificationsAlerts.ts:26
e.fire @ event.ts:567
t.notify @ notifications.ts:113
t.notify @ notificationService.ts:52
t.prompt @ notificationService.ts:91
t._onExtensionHostCrashed @ extensionService.ts:482
(anonymous) @ extensionService.ts:451
e.fire @ event.ts:567
t._onExtHostProcessExit @ extensionHost.ts:487
(anonymous) @ extensionHost.ts:246
emit @ events.js:182
ChildProcess._handle.onexit @ internal/child_process.js:237
extensionHost.ts:325 [Extension Host] debugger listening on port 52754
extensionHost.ts:231 Extension Host
extensionHost.ts:232 Debugger listening on ws://127.0.0.1:52754/e24a6a98-5f4b-4650-860d-bb34156f8400
For help, see: https://nodejs.org/en/docs/inspector

extensionHost.ts:231 Extension Host
extensionHost.ts:232 dyld: lazy symbol binding failed: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
Referenced from: /Users/renarsvilnis/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node
Expected in: flat namespace

dyld: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
Referenced from: /Users/renarsvilnis/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node
Expected in: flat namespace

extensionService.ts:457 Extension host terminated unexpectedly. Code: null Signal: SIGABRT
t._onExtensionHostCrashed @ extensionService.ts:457
(anonymous) @ extensionService.ts:451
e.fire @ event.ts:567
t._onExtHostProcessExit @ extensionHost.ts:487
(anonymous) @ extensionHost.ts:246
emit @ events.js:182
ChildProcess._handle.onexit @ internal/child_process.js:237
notificationsAlerts.ts:40 Extension host terminated unexpectedly.
t.onDidNotificationChange @ notificationsAlerts.ts:40
(anonymous) @ notificationsAlerts.ts:26
e.fire @ event.ts:567
t.notify @ notifications.ts:113
t.notify @ notificationService.ts:52
t.prompt @ notificationService.ts:91
t._onExtensionHostCrashed @ extensionService.ts:482
(anonymous) @ extensionService.ts:451
e.fire @ event.ts:567
t._onExtHostProcessExit @ extensionHost.ts:487
(anonymous) @ extensionHost.ts:246
emit @ events.js:182
ChildProcess._handle.onexit @ internal/child_process.js:237

</details>

@Ravi448
Copy link

Ravi448 commented Feb 7, 2019

image

Having this problem after update.

Can any one help me out, or tell me how to downgrade vscode?

@JM-Mendez
Copy link

I was having problems with the Settings-Sync extension. I was able to get it working by uninstalling fs-extra and fs-events from my global node_modules.

@acwo
Copy link

acwo commented Feb 7, 2019

My extensions broke too. Most of them. Like Project Manager and other important for me. Seems that they don't work on a new version of vscode. Not cool.

Edit:
Uninstalling version 1.31 and going back to version 1.30 works.
You can download 1.30 from https://code.visualstudio.com/updates/v1_30

👆 👆 👆

@ModernWebService
Copy link
Author

For me I went straight to re-installing VSCode fresh and seems to have cleaned out whatever was causing my issue. I still have the same extensions as before I believe, since I have it setup for laravel Node and some Go development. However, my dev tools were throwing similar errors as screenshot above. It seems like it may have broke something that these plugins were listening on, was in the middle of deploying a long project when this happened so I did not have time to mess around with dissecting what the root cause was.

@ModernWebService
Copy link
Author

@Ravi448 look at @acwo 's comment, has a link to 1.30 which is the previous version

@tamuratak
Copy link
Contributor

The cause is that node.js called by a VSCode extension host process tries to load modules in /Users/username/node_modules if it cannot find modules in /Users/username/.vscode/extensions/.../node_modules for each extension. This is a default behavior of node.js. See Loading from node_modules Folders.

I think VSCode should clear some entries of module.paths on extension host processes to prevent this behavior.

To workaround this issue, I recommend moving /Users/username/node_modules to /Users/username/npm/node_modules.

@renarsvilnis
Copy link

For now, I just downloaded v1.32 version and disabled updates in settings.json.

Didn't have to reinstall the extensions

{
  "extensions.autoUpdate": false,
  "update.channel": "none"
}

@malun666
Copy link

malun666 commented Feb 8, 2019

@alexandrudima , As I checked, the crash dosn't occur after uninstalling the following plugin as you said.

VS Code for Node.js - Development Pack
https://marketplace.visualstudio.com/items?itemName=nodesource.vscode-for-node-js-development-pack

You may reproduce after installing this plugin, I guess.

(update) Actually the above plugin consists of a lot of plugins. As I tested, the crash dosn't occur after installing each of them. The crash only occurs after installing the the plugin itself.

(update2) I found another plugin which crashes.

Settings Sync
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync


thanks, disabled the Settings Sync extension ,my vscode was backed in business!

@shanalikhan
Copy link

shanalikhan commented Apr 5, 2019

I'm the author of Settings Sync.

Users has been reporting about extension host killed by Settings Sync.

We removed the chokidar dependency from Settings-Sync which caused this problem, by replacing the vscode file watcher api.
But later found in documentation that vscode File Watcher only works for the workspaces file change events.

Its only broken On Mac, but works on Windows and Linux.

My main concern is:
Why some extension should be able to kill vscode extension host itself?
It works in other OS other than Mac.

@alexandrudima whats your views about it?

@tamuratak
Copy link
Contributor

@shanalikhan, see my comment #68024 (comment).

@hdiggens
Copy link

hdiggens commented Oct 1, 2019

I was having a similar issue with Microsoft Remote-Shell.
tamuratak post with regards to the node_modules and the NODE_PATH, resolved my issue.

image

VS-Code version 1.38.1

@alexdima alexdima modified the milestone: On Deck Oct 1, 2019
@alexdima alexdima added this to the October 2019 milestone Oct 2, 2019
@alexdima alexdima added electron-4.0.x-update and removed info-needed Issue requires more information from poster labels Oct 9, 2019
@alexdima alexdima modified the milestones: October 2019, November 2019 Oct 28, 2019
@alexdima alexdima modified the milestones: November 2019, December 2019 Dec 2, 2019
@alexdima alexdima modified the milestones: January 2020, February 2020 Jan 27, 2020
@alexdima alexdima modified the milestones: February 2020, On Deck Feb 21, 2020
@alexdima
Copy link
Member

alexdima commented Mar 9, 2020

Here is a easier repro for the global paths:

  • package.json:
{
    "publisher": "alex",
    "name": "68024",
    "version": "0.0.0",
    "engines": {
        "vscode": "^1.0.0"
    },
    "activationEvents": [
        "*"
    ],
    "main": "index.js",
    "dependencies": {
        "fast-plist": "^0.1.2"
    }
}
  • index.js:
exports.activate = function (ctx) {
    const Module = require('module');
    console.log(Module._resolveLookupPaths('$$$test$$$', module));
}

Observe how 3 global lookup folders are present (the last 3):

0: "/Users/alex/.vscode-oss-dev/extensions/68024/node_modules"
1: "/Users/alex/.vscode-oss-dev/extensions/node_modules"
2: "/Users/alex/.vscode-oss-dev/node_modules"
3: "/Users/alex/node_modules"
4: "/Users/node_modules"
5: "/node_modules"
6: "/Users/alex/.node_modules"
7: "/Users/alex/.node_libraries"
8: "/Users/alex/src/vscode/.build/electron/Code - OSS.app/Contents/Frameworks/Code - OSS Helper (Renderer).app/Contents/lib/node"

With my proposed change, this gets reduced to:

0: "/Users/alex/.vscode-oss-dev/extensions/68024/node_modules"
1: "/Users/alex/.vscode-oss-dev/extensions/node_modules"
2: "/Users/alex/.vscode-oss-dev/node_modules"
3: "/Users/alex/node_modules"
4: "/Users/node_modules"
5: "/node_modules"

@alexdima alexdima changed the title Latest update broke extensions 1.31.0 Mac Node modules are looked up in global paths Mar 9, 2020
@alexdima alexdima modified the milestones: On Deck, March 2020 Mar 9, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extension-host Extension host issues
Projects
None yet
Development

No branches or pull requests