How can I resolve "could not use PowerShell to find Visual Studio 2017 or newer" while installing kibana


I have visual studio 2022 community and visual studio 2022 build tools installed and config them with npm. But when I try to install kibana I encounter this error:

could not use PowerShell to find Visual Studio 2017 or newer

This indicates that the installation process is unable to find the path to the PowerShell and visual studio 2015 C++.

I have tried to run all the commands with the admin level and still the same node-gyp errors occur.

How can I get past these errors?
I appreciate hints.

are you trying to build kibana or just run kibana?

Thank you for the reply.

My initial aim is to build but I think to be able to do that I need to run kibana and Elasticsearch as prequisites.

This is the path I've followed so far:

I cloned kibana and followed this guide for getting started. I had many errors and I resolved most of them except for this one.

could not use PowerShell to find Visual Studio 2017 or newer

I switched to docker and pulled both kibana and elasticSearch.

Then I considered that I need to install both of them separately as well. Now I installed kibana but not elasticSearch.

I can generate the enrollment token on docker via the Elasticsearch terminal but I have not been able to get the validation key. I'll re-follow this guide to find more insights.

I might have missed some stages here. I appreciate any inputs I receive.

I think the easiest way to get started is to run them from the tar.gz(Linux) or zip(Windows) packages. They come with pretty much anything you need to run them and they are like a portable install, so they won't leave any traces if you decide to move with other packages.

Thank you for the reply.

I could find a hint for the "Could not run Powershell" problem. Setting the execution policy to bypass can solve this.

But it seems that my system has some sort of cache that prevents the execution. One of these could be the bazelisk cache

It also seems git keeps some kind of history in terms of previous errors because Although I run kbn yarn reset or clean or yarn cache clean I still face previous issues.

And after a couple of failed installation processes, it can not find the path for the bazeliskversion file in the root folder.

Running from source is not supported on Windows due to how bazelisk works. The only way to do it is to use WSL to run it.

Will an attempt to install kibana on ubuntu make bazelisk work? I can switch to ubuntu.

I've tried docker, and the configuration for Elasticsearch as a prerequisite of kibana from the last section of this source initially worked for me.

$ docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node"

I still need to configure
docker compose, volume, and docker files.

yes it will work on ubuntu or macos. or ubuntu in windows with WSL.
As for docker, you don't need to configure much in the docker-compose, just add both of them to the same network. map the ports and add some a volume to ES for data.
There are various docker_compose.yml samples online, I think most of them will work with minimal change.

Thank you for the follow-up replies. Highly appreciate it.

In regard to Docker,

The missing step for me is when I tried to map them to one another, I received the error "Could not fetch". I notice that when I pulled elastic for the first time and tried to generate an enrollment token, only one it time gave me a unique token.

When I inserted the token into the kibana configuration page and then inserted the validation key, I received the error "couldn't fetch" .

I think it is because it wasn't a discovery.type=single-node or it can be because of the net.

When I tried to generate another enrollment token on docker it gave me the same exact token as before and I was not able to generate a new token.

The second problem I have is how to locate the kibana docker files.
As for other projects, I cloned the repository and installed them with a similar yarn command.

When I opened the project on VScode It automatically made configurations with the VScode dev container and redirected me to a URL.

I tried to do the same with Remote - Containers extension for kibana but I couldn't do the same. It didn't read and show all the docker files and I could not make any changes to the files.

Also related to the docker files, previously the yarn kbn bootstrap was not done and this could be a reason.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.