Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

zsh:2: command not found: -f #9

Closed
mirsella opened this issue Mar 22, 2021 · 10 comments
Closed

zsh:2: command not found: -f #9

mirsella opened this issue Mar 22, 2021 · 10 comments
Labels
bug Something isn't working

Comments

@mirsella
Copy link

mirsella commented Mar 22, 2021

i have zsh set as my shell

neovim --version :

NVIM v0.5.0-dev+1166-g070e084a6
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az205-228

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

it seems to be successfully installed, but an error is still thrown. it does this for every lsp i tried

zsh:2: command not found: -f
Wrote to /home/mirsella/.local/share/nvim/lspinstall/vue/package.json:

{
  "name": "@lspinstall/vue",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": ""
}


npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more inform
ation.

added 139 packages, and audited 140 packages in 7m

18 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

[Process exited 0]

@kabouzeid
Copy link
Owner

Thanks for reporting, it's fixed now :)

@kabouzeid kabouzeid added the bug Something isn't working label Mar 22, 2021
@SandWoodJones
Copy link

Currently experiencing a similar problem with the fish shell:

When trying to install lua:

fish: Unsupported use of '='. In fish, please use 'set os $(uname -s | tr "[:upper:]" "[:lower:]")'.

[Process exited 123]

When trying to install python, vim or bash:

set: Erase needs a variable name

Standard input (line 1):
set -e
^

(Type 'help set' for related documentation)
fish: Unknown command: '[[ ! -f package.json ]]'
fish:
  [[ ! -f package.json ]] && npm init -y --scope=lspinstall || true
  ^

up to date, audited 2 packages in 793ms

found 0 vulnerabilities

[Process exited 0]

@mirsella
Copy link
Author

@kabouzeid you can't just launch the shell scripts in sh or bash instead of using wathever non posix shell people have set as default ?

@kabouzeid
Copy link
Owner

kabouzeid commented Mar 22, 2021

@mirsella your problem wasn't because of zsh, it was just a typo in the scripts. But you are right, it would be better to always use bash.
Currently I'm using this command to execute the script:

vim.fn.termopen("set -e\n" .. servers[lang].install_script, {["cwd"] = path, ["on_exit"] = onExit})

Might be a good idea to also prepend /usr/bin/env bash.

@mirsella
Copy link
Author

Might be a good idea to also prepend /usr/bin/env bash.

seems like a good idea that will solve this issue and a lot of future ones

@kabouzeid
Copy link
Owner

Should I better use /usr/bin/env bash or /usr/bin/env sh for this?

@kabouzeid
Copy link
Owner

Unfortunately this doesn't work as I expected. But I wanted to move away from termopen anyways.
I can't fix this quickly right now, in the mean time @SandWoodJones you can use SHELL=bash nvim to start nvim when you want to use the :LspInstall command.

@mirsella
Copy link
Author

I've never wrote vimscript, and even less lua so I have no idea how bash -c or sh -c doesn't work well, can you elaborate ?

and between sh and bash, it's not really important with sh you might support +0.1% of users who don't have bash installed, but bash have features that sh don't have, like [[ ]] doesn't exist in sh and [ ] have some different syntax than [[ ]]. maybe better to use bash since your script work for bash but would need change to work with sh

@kabouzeid
Copy link
Owner

I would need to put the install_script in quotes, but the install scripts them selfs use quotes and I don't want to escape them all.

'bash -c "' + install_script + '"'

@mirsella
Copy link
Author

yep, that's annoying.

maybe put the install script in a file, and then call the file with bash ? but it would require to create a file and maybe the install script can't run in a file ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants