awk-language-server icon indicating copy to clipboard operation
awk-language-server copied to clipboard

Install > missing chmod +x

Open pablos-here opened this issue 1 year ago • 4 comments

Hi,

Tickled that there's an awk LSP. Thank you!

A slight install issue, ../lib/node_modules/awk-language-server/out/cli.js needs its execution bit set.

Test case

With a fresh install:

  • # npm i -g awk-language-server
  • $ awk-language-server faults with /usr/local/bin/awk-language-server: Permission denied.

Work-around

# cd /usr/local/bin # chmod +x ../lib/node_modules/awk-language-server/out/cli.js

pablos-here avatar Jan 08 '23 00:01 pablos-here

Hi @pablos-here

I believe it's not related and strongly advise to avoid installing npm packages as privileged user.

You can change this behavior with something like this:

npm config set prefix=$HOME/.npm

Now you install every npm package without sudo and it's placed in your home directory. To make binaries available on your command line you need to append this to your ~/.profile or ~/.bashrc and start new terminal session:

PATH="$HOME/.npm/bin:$PATH"

Beaglefoot avatar Jan 09 '23 20:01 Beaglefoot

I believe it's not related

Hi @Beaglefoot ,

Would you please elaborate why it's not related?

and strongly advise to avoid installing npm packages as privileged user.

I appreciate the warning.

pablos-here avatar Jan 09 '23 21:01 pablos-here

Would you please elaborate why it's not related?

Well, this whole cli thing works because of this: https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bin

First of all typescript files are compiled to js in out dir and there is no executable bit:

$ stat -c %A out/cli.js
-rw-r--r--

Then js files are published as npm package and aforementioned bin rule is applied.

On installation what's available on PATH is just a symbolic link:

# stat -c "%N" $(which awk-language-server)
'/usr/local/bin/awk-language-server' -> '../lib/node_modules/awk-language-server/out/cli.js'

And the real js file has executable bit set for all users:

# stat -L -c "%A   %N" $(which awk-language-server)
-rwxr-xr-x   '/usr/local/bin/awk-language-server'

If your result is different then probably some other rules are applied by your system or configuration. I would suggest to check with docker.

Beaglefoot avatar Jan 12 '23 20:01 Beaglefoot

Hi @Beaglefoot ,

Thank you for the information. I appreciate it.

I've installed several[1] other npm-based language servers and they all set the execution bit on the source file. The exception is awk-language-server

Given the above, it would suggest that the issue is with the packaging rather than my environment.

Have you tested installing awk-language-server globally?

If it helps any, I'm on a rolling distro (openSUSE Tumbleweed). Assuming you've tested it globally and it works, perhaps there's an issue looming.

Thx!

References

  • bash-language-server
  • jslint
  • pyright
  • vscode-css-language-server
  • vscode-eslint-language-server
  • vscode-html-language-server
  • vscode-json-language-server
  • vscode-markdown-language-server

pablos-here avatar Jan 12 '23 20:01 pablos-here