user12987437
user12987437

Reputation:

Why is preact not getting recognized in the terminal even after installing it?

I have installed Preact but it’s not getting recognized in the terminal. First, I went to the official website of PreactJS. The doc says that I have to run npm install -g preact-cli. As I am using Yarn, I ran yarn global add preact-cli. It was installed successfully but with a lot of warnings. Then I ran preact create default first-preact-app. But it's showing an error that "The term 'Preact' is not recognized as a name of a cmdlet, function, script file or executable program."

I have tried force cleaning the cache and reinstalling preact-cli. But it doesn't work. Two of the warnings are that preact and preact-render-to-string have unmet peer dependency. So, I have installed them also. But it still doesn't work.

I have tried running npm and experimented with the commands also. But it didn't work. So, how can I fix the problem?

I have run these commands using Powershell and Git bash on Windows 10. I am trying to install Preact 10.5.12 using Yarn 1.22.5. And a point to be noted, I tried running yarn dlx but it returns an error that "command not found". And when the installation of preact and preact-render-to-string gets finished, yarn gives and warning that they have no binaries.

EDIT: Perhaps, it was a problem with Windows. The problem has gone after reinstalling it.

Upvotes: 0

Views: 1244

Answers (1)

rschristian
rschristian

Reputation: 2966

Your problem almost certainly is that preact-cli was not on your PATH - a list of programs that are globally accessible.

For what it's worth, we don't recommend installing globally. The site may still say that but the repository correctly recommends using npx instead.

Upvotes: 1

Related Questions