Skip to content

npm module doesn't install extension dependencies #1961

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

Closed
tonywu3 opened this issue Aug 10, 2020 · 22 comments
Closed

npm module doesn't install extension dependencies #1961

tonywu3 opened this issue Aug 10, 2020 · 22 comments
Assignees
Milestone

Comments

@tonywu3
Copy link

tonywu3 commented Aug 10, 2020

Did a fresh install of the docker image and keep running into the following error:
Running the contributed command: 'emmet.expandAbbreviation' failed.

My only setting is:
{ "emmet.triggerExpansionOnTab": true }

No other extensions installed/enabled. Straight from installation to opening a new html file and trying to expand
!
or
ul>li*5
results in that error.

Current version details:

  • code-server: v3.4.0
  • VS Code: v1.45.1
  • Commit: 69ad529
  • Date: 2020-05-27T23:38:22Z (2 mos ago)
@code-asher
Copy link
Member

I tried this out with the codercom/code-server:3.4.0 Docker image but it's working for me. Does VS Code give you any extra information about why the command failed? It might help to check the output panel and look for logs under the extension host in addition to anything in the browser console.

@tonywu3
Copy link
Author

tonywu3 commented Aug 11, 2020

Thanks for the tip.

Here's the output from Log (Remote Extension Host). I've also tried updating the node installation to v12.18.3

[2020-08-11 15:54:20.929] [exthost] [error] [vscode.emmet] provider FAILED
[2020-08-11 15:54:20.931] [exthost] [error] Error: Cannot find module 'vscode-emmet-helper'
Require stack:
- /node_modules/code-server/lib/vscode/extensions/emmet/dist/extension.js
- /node_modules/code-server/lib/vscode/out/vs/loader.js
- /node_modules/code-server/lib/vscode/out/bootstrap-amd.js
- /node_modules/code-server/lib/vscode/out/bootstrap-fork.js
	at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
	at Function.Module._load (internal/modules/cjs/loader.js:842:27)
	at Function.t._load (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:956:846)
	at Function.n._load (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:926:106)
	at Function.i._load (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:922:391)
	at Module.require (internal/modules/cjs/loader.js:1026:19)
	at require (internal/modules/cjs/helpers.js:72:18)
	at Object.<anonymous> (/node_modules/code-server/lib/vscode/extensions/emmet/dist/extension.js:1:59931)
	at n (/node_modules/code-server/lib/vscode/extensions/emmet/dist/extension.js:1:158)
	at Object.t.getEmmetHelper (/node_modules/code-server/lib/vscode/extensions/emmet/dist/extension.js:1:3341)
	at t.DefaultCompletionItemProvider.provideCompletionItemsInternal (/node_modules/code-server/lib/vscode/extensions/emmet/dist/extension.js:1:53050)
	at t.DefaultCompletionItemProvider.provideCompletionItems (/node_modules/code-server/lib/vscode/extensions/emmet/dist/extension.js:1:52275)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:675:521
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:51:988
	at new Promise (<anonymous>)
	at Object.t.asPromise (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:51:960)
	at H.provideCompletionItems (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:675:492)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:694:883
	at e._withAdapter (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:685:862)
	at e.$provideCompletionItems (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:694:861)
	at e._doInvokeHandler (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:790:363)
	at e._invokeHandler (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:790:55)
	at e._receiveRequest (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:788:688)
	at e._receiveOneMessage (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:787:518)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:785:754
	at e.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:67)
	at v.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:232:615)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:958:347
	at e.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:67)
	at v.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:232:615)
	at t.PersistentProtocol._receiveMessage (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:237:17)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:234:155
	at e.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:67)
	at p.acceptChunk (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:230:129)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:229:483
	at e.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:67)
	at f._acceptChunk (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:241:182)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:239:346
	at Socket.t (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:238:565)
	at Socket.emit (events.js:315:20)
	at addChunk (_stream_readable.js:295:12)
	at readableAddChunk (_stream_readable.js:271:9)
	at Socket.Readable.push (_stream_readable.js:212:10)
	at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
[2020-08-11 15:55:01.133] [exthost] [error] TypeError: s.updateExtensionsPath is not a function
	at c (/node_modules/code-server/lib/vscode/extensions/emmet/dist/extension.js:1:2978)
	at Object.t.getEmmetHelper (/node_modules/code-server/lib/vscode/extensions/emmet/dist/extension.js:1:3348)
	at Object.t.expandEmmetAbbreviation (/node_modules/code-server/lib/vscode/extensions/emmet/dist/extension.js:1:41608)
	at /node_modules/code-server/lib/vscode/extensions/emmet/dist/extension.js:1:48572
	at e._executeContributedCommand (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:627:753)
	at e.$executeContributedCommand (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:628:104)
	at e._doInvokeHandler (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:790:363)
	at e._invokeHandler (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:790:55)
	at e._receiveRequest (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:788:739)
	at e._receiveOneMessage (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:787:518)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:785:754
	at e.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:67)
	at v.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:232:615)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:958:347
	at e.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:67)
	at v.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:232:615)
	at t.PersistentProtocol._receiveMessage (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:237:17)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:234:155
	at e.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:67)
	at p.acceptChunk (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:230:129)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:229:483
	at e.fire (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:67)
	at f._acceptChunk (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:241:182)
	at /node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:239:346
	at Socket.t (/node_modules/code-server/lib/vscode/out/vs/workbench/services/extensions/node/extensionHostProcess.js:238:565)
	at Socket.emit (events.js:315:20)
	at addChunk (_stream_readable.js:295:12)
	at readableAddChunk (_stream_readable.js:271:9)
	at Socket.Readable.push (_stream_readable.js:212:10)
	at TCP.onStreamRead (internal/stream_base_commons.js:186:23) emmet.expandAbbreviation

@code-asher
Copy link
Member

It looks like one of the dependencies for the extension is missing. It doesn't look like our image since we put code-server in /usr/lib/code-server. How did you install code-server?

There should be a directory at /node_modules/code-server/lib/vscode/extensions/emmet/node_modules/vscode-emmet-helper. For example here's what our 3.4.0 Docker image has:

ls -la /usr/lib/code-server/lib/vscode/extensions/emmet/node_modules/
total 8
drwxr-xr-x 6 root root  6 May 28 02:19 .
drwxr-xr-x 5 root root  8 May 28 02:20 ..
drwxr-xr-x 3 root root  3 May 28 02:19 @emmetio
drwxr-xr-x 3 root root 10 May 28 02:20 jsonc-parser
drwxr-xr-x 4 root root  9 May 28 02:20 vscode-emmet-helper
drwxr-xr-x 3 root root  7 May 28 02:20 vscode-languageserver-types

One workaround is to manually install the missing dependency:

cd /node_modules/code-server/lib/vscode/extensions/emmet
yarn

@code-asher code-asher added the waiting-for-info Waiting for more information from submitter label Aug 13, 2020
@nhooyr
Copy link
Contributor

nhooyr commented Aug 17, 2020

Please try using the latest version anyway. v3.4.1.

@tonywu3
Copy link
Author

tonywu3 commented Aug 18, 2020

Thanks y'all. You're right @code-asher , this isn't the image direct from cdr. I'm using this docker image: https://github.com/linuxserver/docker-code-server

I initially thought it was a code-server problem but it may be a problem with that linuxserver docker instead or how it's being installed with Unraid... Just odd other folks haven't ran into a similar problem on such a popular feature.

In any case, thanks for the help.

@tonywu3 tonywu3 closed this as completed Aug 18, 2020
@aptalca
Copy link

aptalca commented Aug 18, 2020

@code-asher @nhooyr
linuxserver team member here

We install code-server via yarn --production global add code-server@"$CODE_VERSION" as seen here: https://github.com/linuxserver/docker-code-server/blob/master/Dockerfile#L42-L49 as instructed in your docs: https://github.com/cdr/code-server/blob/master/doc/install.md#yarn-npm

But that doesn't seem to compile the modules like emmet. Is there a recommended way to have everything compiled?

By the way, the reason we don't have 3.4.1 is because the naming convention issue with the latest github stable release breaks our ci, so we decided to skip that release. We didn't realize it would be quite a long time before the next release.

EDIT: As a test, I built a local image for 3.4.1 and that has more related issues. It seems spdlog is also not compiled and generates errors in the log when code-server is started

@tonywu3 tonywu3 reopened this Aug 18, 2020
@code-asher
Copy link
Member

Sounds like our npm package needs some work!

@code-asher code-asher changed the title Emmet expand abbreviation error npm module is missing dependencies Aug 18, 2020
@code-asher code-asher added needs-investigation and removed waiting-for-info Waiting for more information from submitter labels Aug 18, 2020
@nhooyr
Copy link
Contributor

nhooyr commented Aug 31, 2020

Very weird, the .deb is generated from taking then npm package and installing it so if there is a bug with the npm package, it should occur in our Dockerfile as well.

@nhooyr
Copy link
Contributor

nhooyr commented Aug 31, 2020

Only difference seems to be we're passing --frozen-lockfile as well to yarn.

See https://github.com/cdr/code-server/blob/ada69969ac839b6133d6589854c5422f31855273/ci/build/build-standalone-release.sh#L25

@code-asher
Copy link
Member

Oh wait is it because we delete scripts from VS Code's package.json so there's no postinstall step that installs the extension dependencies?

@nhooyr
Copy link
Contributor

nhooyr commented Sep 1, 2020

Oh wait is it because we delete scripts from VS Code's package.json so there's no postinstall step that installs the extension dependencies?

https://github.com/cdr/code-server/blob/b509063e143bbf74b74ec295260c4fd5f6332f71/ci/build/npm-postinstall.sh#L38

We do it ourselves afterwards.

@nhooyr
Copy link
Contributor

nhooyr commented Sep 1, 2020

My point is that it's unlikely there's something wrong with the build process otherwise we'd be seeing many reports of the same issue with our standalone releases as well right.

@code-asher
Copy link
Member

code-asher commented Sep 1, 2020

I mean there's nothing that moves into the extension directories (like extensions/emmet) and installs their node modules as well.

@code-asher
Copy link
Member

Since I think that's in the main postinstall and not the one in extensions.

@code-asher
Copy link
Member

One idea would be to cd into each extension directory and run yarn --production --frozen-lockfile.

@code-asher
Copy link
Member

code-asher commented Sep 1, 2020

As for why this happens, maybe the npm publishing process leaves out any directories called node_modules? So even though extensions/emmet/node_modules exists it might be getting stripped out in the published npm module.

@nhooyr
Copy link
Contributor

nhooyr commented Sep 2, 2020

I mean there's nothing that moves into the extension directories (like extensions/emmet) and installs their node modules as well.

Ahhh true, I guess we're that at some point early in the build process! Probably when building VS Code.

@aptalca Best if you guys switch to our install script for now as that'll use a .deb which will have the proper dependencies.

@nhooyr nhooyr changed the title npm module is missing dependencies npm module doesn't install extension dependencies Sep 2, 2020
nhooyr added a commit that referenced this issue Sep 2, 2020
@aptalca
Copy link

aptalca commented Sep 2, 2020

We can't do the deb because you don't publish an arm32 package
I'll dig into your build process to see if I can figure it out

@aptalca
Copy link

aptalca commented Sep 2, 2020

I dug in a little bit more. Switched to using --frozen-lockfile, which changes the path for node_modules to somewhere under /usr/local/share, and it fixes an issue with the terminal not starting. However, emmet is still not functional. I also tried these steps: https://github.com/cdr/code-server/blob/acf098484d33d6f159f1f29d75587a4ff7c0a94b/ci/build/npm-postinstall.sh#L35-L45 and that did not help.

Looking at the earlier comment about running yarn in the emmet folder, when I do that, the node_modules folder is created in there, but there is no vscode-emmet-helper in that folder.

@code-asher
Copy link
Member

Ah yup, looks like VS Code strips the dependencies from the extension package.json so yarn installs nothing: #2041 (comment)

@aptalca
Copy link

aptalca commented Oct 15, 2020

@nhooyr @code-asher thanks guys, I can confirm that these built in extensions now work with an npm/yarn install of 3.6.0

@tonywu3 emmet abbrev is working out of the box now on the latest

@tonywu3
Copy link
Author

tonywu3 commented Oct 15, 2020

Thanks everyone for your hard work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants