0

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.

  • "It doesn't work" is as helpful as going to the doctor and saying "it hurts, fix it". Please provide stack traces, the commands you've entered, versions etc. – Phix Mar 02 '21 at 22:39
  • Perhaps, it was a problem with windows. I reinstalled Windows yesterday and now the problem has gone. –  Mar 04 '21 at 15:29

1 Answers1

1

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.

rschristian
  • 1,730
  • 1
  • 6
  • 15
  • Thank you @rschristian for your answer. But i can't test your answer now. As I said in the comment that the problem has gone after reinstalling windows. I should have edited the question. Still thank you. –  Mar 13 '21 at 14:38