rcjsuen / dockerfile-language-server

A language server for Dockerfiles powered by Node.js, TypeScript, and VSCode technologies.
MIT License
377 stars 15 forks source link

Fails to execute when using a custom npm prefix #252

Closed jzelinskie closed 2 years ago

jzelinskie commented 3 years ago

My .npmrc uses a custom prefix to install binaries into $XDG_DATA_HOME:

prefix=${XDG_DATA_HOME}/node

This breaks docker-langserver because it's using a relative import to execute the server:

cat $XDG_DATA_HOME/node/bin/docker-langserver

   1   │ #!/usr/bin/env node
   2   │ /* --------------------------------------------------------------------------------------------
   3   │  * Copyright (c) Remy Suen. All rights reserved.
   4   │  * Licensed under the MIT License. See License.txt in the project root for license information.
   5   │  * ------------------------------------------------------------------------------------------ */
   6   │ require("../lib/server");
rcjsuen commented 3 years ago

@jzelinskie Thank you for your bug report. I'll do some searching to see what the right solution is here.

rcjsuen commented 3 years ago

@jzelinskie I looked at both Mocha and TypeScript and they both seem to do the same thing here.

Do you have an example of an open source project that works for your setup?

jzelinskie commented 2 years ago

It was forever ago that I reported this and I can't seem to reproduce this on my new laptop.

$ cat .npmrc
prefix=${XDG_DATA_HOME}/node
$ echo $XDG_DATA_HOME
/Users/jzelinskie/.local/share
$ which docker-langserver
/Users/jzelinskie/.local/share/node/bin/docker-langserver
$ docker-langserver --stdio
^C
rcjsuen commented 2 years ago

@jzelinskie Thanks for getting back to us. Have a nice day!