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

"Can't find bash-language-server on your PATH...." on Windows #41

Closed
fakuivan opened this issue Apr 27, 2018 · 42 comments
Closed

"Can't find bash-language-server on your PATH...." on Windows #41

fakuivan opened this issue Apr 27, 2018 · 42 comments

Comments

@fakuivan
Copy link

fakuivan commented Apr 27, 2018

I've installed the package as advised but the extension fails with this error:

image

PS C:\Users\fakui> npm i -g bash-language-server
C:\Users\fakui\AppData\Roaming\npm\bash-language-server -> C:\Users\fakui\AppData\Roaming\npm\node_modules\bash-language-server\bin\main.js
+ [email protected]
updated 1 package in 1.253s
PS C:\Users\fakui> node -v
v10.0.0
PS C:\Users\fakui> (Get-ChildItem Env:Path).Value
C:\Python27\;C:\Python27\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Python36\Scripts\;C:\Program Files\Python36\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Common Files\Autodesk Shared\;D:\Program_Files\Strawberry\c\bin;D:\Program_Files\Strawberry\perl\site\bin;D:\Program_Files\Strawberry\perl\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\nodejs\;C:\Users\fakui\AppData\Local\Microsoft\WindowsApps;;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\fakui\AppData\Roaming\npm
@skovhus
Copy link
Collaborator

skovhus commented Apr 27, 2018

Thanks for reporting this. It might be related to #40

@mads-hartmann
Copy link
Collaborator

@fakuivan Thanks for reporting this. I've released version 1.3.1 which includes #40. Please upgrade the bash language server (npm i -g bash-language-server) and re-open if this is still an issue :)

@fakuivan
Copy link
Author

Nope, still having the same issue.

PS C:\Windows\system32> npm i -g bash-language-server
C:\Users\fakui\AppData\Roaming\npm\bash-language-server -> C:\Users\fakui\AppData\Roaming\npm\node_modules\bash-language-server\bin\main.js
+ [email protected]
updated 1 package in 5.686s

@mads-hartmann
Copy link
Collaborator

@fakuivan Damn, alright, as I don't have access to windows machines at the moment I'd love your help debugging this issue. Head over to #5 to see what other users have tried.

@fakuivan
Copy link
Author

@mads-hartmann As far as I understand it, finding the path to the executable is not the problem:

PS C:\Windows\system32> &"$(Join-Path "$(npm.cmd bin -g)" "bash-language-server.cmd")" -v
Version is 1.3.1

(if that's what vscode-client/src/util.ts does)

@antonio-petricca
Copy link

I have the same issue:

  • Linux Mint 18.3 (Ubuntu 16.04)
  • NodeJS 10.1.0
  • Bash Language Server 1.3.1

Running it from shell I get this error:

$ bash-language-server
internal/modules/cjs/loader.js:573
throw err;
^

Error: Cannot find module './build/Debug/tree_sitter_runtime_binding'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
at Function.Module._load (internal/modules/cjs/loader.js:497:25)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/usr/local/lib/node_modules/bash-language-server/node_modules/tree-sitter/index.js:5:13)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)

@fakuivan
Copy link
Author

Just to clarify, this issue is supposed to be open.

@skovhus skovhus reopened this May 27, 2018
@JoshRagem
Copy link

I think this is failing to require the Debug build because of this error (or similar) trying to get the Release build:

> require('./build/Release/tree_sitter_runtime_binding')
Error: The module '/usr/lib/node_modules/bash-language-server/node_modules/tree-sitter/build/Release/tree_sitter_runtime_binding.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 59. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

this is my setup with npm:6.1.0 node:v10.2.1 on ubuntu

@roblogic
Copy link

roblogic commented Jun 1, 2018

This thread could be conflating 2 issues here. I think that you can build bash-language-server successfully on Windows if you have the correct prerequisites. Building it with the npm build tools, puts the application somewhere in your user profile and in your PATH (in my case it's %USERPROFILE%\AppData\Roaming\npm\bash-language-server, YMMV.

However the ability of VSCode or Atom to launch it is a separate issue. Despite the bash-language-server existing in the Windows %PATH% and responding correctly in Powershell, it seems that the Node applications have trouble spawning it as a process and issue misleading error messages like ENOENT and claim that they can't find bash-language-server. IMHO it looks like a bug in the Node spawn command in Windows. Some elaboration here: bash-lsp/ide-bash#4

Building on Windows

First you need to install python and windows build tools via npm in Powershell (Administrator mode)... per https://www.npmjs.com/package/windows-build-tools
installed to %USERPROFILE%.windows-build-tools\python27
be patient, it may take 15 minutes or more, even on a high spec PC

npm install --global --production windows-build-tools

Then install bash-language-server

npm i -g bash-language-server

image

Launching from VSCode or Atom

For Atom, I think it's happening here in main.js. Maybe "spawn" isn't smart enough to find the npm package in windows

https://github.com/mads-hartmann/ide-bash/blob/ff7acfe95a37915ed8e1effe75df88e2b073c5e0/src/main.js#L29-L31

Similar "spawn" issues on SO:

Possible alternatives to Node spawn on windows:

@antonio-petricca
Copy link

Hi, I am on Linux, not Windows. Thank you ☺️

@Amourspirit
Copy link

I am running window 10 home. I am having the same issues.
I tried installing and re-installing
VS code reports
image

I also tried

Possible alternatives to Node spawn on windows:

https://github.com/MarcDiethelm/superspawn
https://www.npmjs.com/package/cross-spawn

Nothing seems to work still getting same error

PS C:\WINDOWS\system32> bash-language-server -v
Version is 1.3.1
Any Fix for this?

@pryorda
Copy link

pryorda commented Jun 30, 2018

Having the same issue on mac :/

@skovhus
Copy link
Collaborator

skovhus commented Jun 30, 2018

@pryorda I think that might be an unrelated issue... But how did you install the server? Yarn or npm? And which Shell are you using?

@pryorda
Copy link

pryorda commented Jun 30, 2018

zsh, npm i -g bash-language-server

CO007-mac ➜  /tmp npm i -g bash-language-server
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/bash-language-server
npm ERR! path /usr/local/lib/node_modules/bash-language-server
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/bash-language-server'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/bash-language-server']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/bash-language-server\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/bash-language-server' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dpryor/.npm/_logs/2018-06-30T23_28_24_260Z-debug.log
CO007-mac ➜  /tmp sudo npm i -g bash-language-server
Password:
/usr/local/bin/bash-language-server -> /usr/local/lib/node_modules/bash-language-server/bin/main.js
+ [email protected]
updated 1 package in 0.752s
CO007-mac ➜  /tmp bash-language-server
internal/modules/cjs/loader.js:596
    throw err;
    ^

Error: Cannot find module './build/Debug/tree_sitter_runtime_binding'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
    at Function.Module._load (internal/modules/cjs/loader.js:520:25)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/bash-language-server/node_modules/tree-sitter/index.js:5:13)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
CO007-mac ➜  /tmp

@pryorda
Copy link

pryorda commented Jul 1, 2018

Additional Output.

521 verbose lifecycle [email protected]~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/local/lib/node_modules/bash-language-server/node_modules/tree-sitter/node_modules/.bin:/usr/local/lib/node_modules/bash-language-server/node_modules/.bin:/usr/local/lib/node_modules/.bin:/opt/chefdk/bin:/Users/dpryor/.chefdk/gem/ruby/2.4.0/bin:/opt/chefdk/embedded/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/dpryor/go/bin:/usr/lib/go-1.9/bin:/sbin/bin:/snap/bin:/Users/dpryor/.local/bin:/usr/local/opt/[email protected]/libexec/bin:/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/opt/chefdk/gitbin
522 verbose lifecycle [email protected]~install: CWD: /usr/local/lib/node_modules/bash-language-server/node_modules/tree-sitter
523 silly lifecycle [email protected]~install: Args: [ '-c', 'node-gyp rebuild' ]
524 silly lifecycle [email protected]~install: Returned: code: 1  signal: null
525 info lifecycle [email protected]~install: Failed to exec install script
526 timing action:install Completed in 469ms
527 verbose unlock done using /Users/dpryor/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
528 timing stage:rollbackFailedOptional Completed in 73ms
529 timing stage:runTopLevelLifecycles Completed in 4730ms
530 verbose stack Error: [email protected] install: `node-gyp rebuild`
530 verbose stack Exit status 1
530 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:304:16)
530 verbose stack     at EventEmitter.emit (events.js:182:13)
530 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
530 verbose stack     at ChildProcess.emit (events.js:182:13)
530 verbose stack     at maybeClose (internal/child_process.js:961:16)
530 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
531 verbose pkgid [email protected]
532 verbose cwd /usr/local/lib/node_modules
533 verbose Darwin 17.6.0
534 verbose argv "/usr/local/Cellar/node/10.5.0_1/bin/node" "/usr/local/bin/npm" "i" "-g" "bash-language-server"
535 verbose node v10.5.0
536 verbose npm  v6.1.0
537 error code ELIFECYCLE
538 error errno 1
539 error [email protected] install: `node-gyp rebuild`
539 error Exit status 1
540 error Failed at the [email protected] install script.
540 error This is probably not a problem with npm. There is likely additional logging output above.
541 verbose exit [ 1, true ]

@pryorda
Copy link

pryorda commented Jul 1, 2018

Looks like I had to install Xcode, accept the license, blah blah.

Thanks

@mads-hartmann
Copy link
Collaborator

I've just released version 1.3.1 of the VSCode extension which adds a new configuration option bashIde.path. Please see if you can use that to run it on Windows. As for Atom I think it's a good idea to use cross-spawn.

@Lucretia
Copy link

I'm on Gentoo, it can't seem to find the server, because it's dumping the following:

module.js:549
    throw err;
    ^

Error: Cannot find module './build/Debug/tree_sitter_runtime_binding'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/lib64/node_modules/bash-language-server/node_modules/tree-sitter/index.js:5:13)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

Why is it wanting a debug module?

@mads-hartmann
Copy link
Collaborator

@Lucretia Are you setting the path explicitly using the new config options?

I'm not sure about the missing debug module. @maxbrunsfeld any idea?

@Lucretia
Copy link

@mads-hartmann I've had the option not set and had it set, same issue. Running the bash-language-server directly produces the above error.

@pryorda
Copy link

pryorda commented Jul 10, 2018

@Lucretia How did you install bls?

@maxbrunsfeld
Copy link

maxbrunsfeld commented Jul 10, 2018

Why is it wanting a debug module?

I think that on an older version of Tree-sitter, that error was thrown even if the Release module failed to load because it would try to 'fall back' to the Debug module. That's been fixed for more recent Tree-sitter versions.

I'm not sure about the missing debug module. maxbrunsfeld any idea?

I'm guessing that people are installing your module with npm manually, so the native modules are not getting compiled against the correct version of node.js, as @JoshRagem reported.

@Lucretia
Copy link

@pryorda npm i -g bash-language-serveras root (on gentoo).

@pryorda
Copy link

pryorda commented Jul 13, 2018

Have you tried to build from source to see what happens?

@antonio-petricca
Copy link

Version 1.3.1 on Ubuntu 18.04 works for me! 👍

@maxbrunsfeld
Copy link

maxbrunsfeld commented Jul 15, 2018

@mads-hartmann Once this PR lands, we could do something similar for tree-sitter-bash, and then users would be able to install the package without having a C compiler toolchain.

@mads-hartmann
Copy link
Collaborator

@maxbrunsfeld I think you forgot the link? 😊

@maxbrunsfeld
Copy link

🤦‍♂️ thanks. I added it above.

@mads-hartmann
Copy link
Collaborator

@maxbrunsfeld Just had a look - that would be amazing - the current install process for this project is way more complicated then I would've liked

@thehandcoder
Copy link

If you change the prefix before installing, it works. You can specify your global lib folder. For example, I did npm config set prefix="/usr/local/" before installing and that fixed the problem

@skovhus
Copy link
Collaborator

skovhus commented Aug 2, 2018

@fakuivan @thehandcoder please try to install the latest bash-language-server by running npm install -g bash-language-server. We hope to have fixed the issue in version 1.5.1 by the help from @wingrunr21.

@alexford-bg
Copy link

I was having this problem as well, and oddly, by running the following command it fixed it for me on Ubuntu 18.04, VS Code 1.27.2:

sudo npm i -g bash-language-server tree-sitter tree-sitter-bash --unsafe-perm

I ran the install command for each of the modules separately, and that didn't work... it was only when I did it all at once did it resolve things.

@vjtc0n
Copy link

vjtc0n commented Oct 2, 2018

@alexford-bg Thank you so much, work like a charm on MacOSX, too.

@Lucretia
Copy link

Lucretia commented Oct 2, 2018

# npm install -g bash-language-server
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.2.0.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-10-02T14_02_39_858Z-debug.log

The tail of that log is:

885 silly pacote prebuild-install@https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.2.0.tgz extracted in 6514ms
886 verbose unlock done using /root/.npm/_locks/staging-5416abac55ed2dd0.lock for /usr/lib64/node_modules/.staging
887 verbose type system
888 verbose stack FetchError: request to https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.2.0.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
888 verbose stack     at ClientRequest.req.on.err (/usr/lib64/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
888 verbose stack     at ClientRequest.emit (events.js:180:13)
888 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:395:9)
888 verbose stack     at TLSSocket.emit (events.js:180:13)
888 verbose stack     at emitErrorNT (internal/streams/destroy.js:64:8)
888 verbose stack     at process._tickCallback (internal/process/next_tick.js:178:19)
889 verbose cwd /root
890 verbose Linux 4.19.0-rc4
891 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "bash-language-server"
892 verbose node v9.11.2
893 verbose npm  v5.6.0
894 error code EAI_AGAIN
895 error errno EAI_AGAIN
896 error request to https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.2.0.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
897 verbose exit [ 1, true ]
Linux rogue 4.19.0-rc4 #1 SMP PREEMPT Sat Sep 22 14:12:36 BST 2018 x86_64 AMD FX(tm)-8350 Eight-Core Processor AuthenticAMD GNU/Linux

@Cavsfan-Linux
Copy link

Cavsfan-Linux commented Mar 31, 2019

I was having this problem as well, and oddly, by running the following command it fixed it for me on Ubuntu 18.04, VS Code 1.27.2:

sudo npm i -g bash-language-server tree-sitter tree-sitter-bash --unsafe-perm

I ran the install command for each of the modules separately, and that didn't work... it was only when I did it all at once did it resolve things.

Thank you! That is THE only thing I could find that worked. This was on MX 18.1 (Continuum)

@nottoseethesun
Copy link

Setting an absolute path for Bash Ide: Path worked for me.

@skovhus
Copy link
Collaborator

skovhus commented May 29, 2019

@nottoseethesun just to be clear, where did you set this? It seems bash-language server and other npm scripts are not on your path....

@nottoseethesun
Copy link

@skovhus I set it in the VSCode Prefs. I did put the server in my path, and I did also do the "hack" of installing the dep's globally as well. I am using nvm, but I used the correct path to the binary. For me anyway, using the shell path didn't work.

@pplmx
Copy link

pplmx commented Jul 1, 2019

I have the same problem. Although I had installed bash-language-server and set BashIDE-path

@briancrink
Copy link

briancrink commented Jul 5, 2019

incurred this problem on mac Catalina, have installed bash-language-server and Xcode 10.2.1 with accepted license.

added to Bash IDE path:

usr/local/bin/bash-language-server

ran:

sudo npm i -g bash-language-server tree-sitter tree-sitter-bash --unsafe-perm

returned:

gyp: No Xcode or CLT version detected!

@chrisduong
Copy link

Still not working same Brian's report.

@skovhus
Copy link
Collaborator

skovhus commented Dec 13, 2019

With the new version (1.4.0) of the VS Code extension, we got rid of the manual npm install step of the bash-language-server. Hopefully, this will resolve npm installation issues. :)

The latest version of bash-language-server (the npm package) should also be easier to install.

Let me know if this solves the issues.

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