codetheweb / tuyapi

🌧 An easy-to-use API for devices that use Tuya's cloud services. Documentation: https://codetheweb.github.io/tuyapi.
MIT License
2.1k stars 343 forks source link

npm: command not found #415

Closed pocahozas closed 3 years ago

pocahozas commented 3 years ago

Hello. I have a problem, maybe it's just a beginners problem. I am using a raspberry Pi 4 con HASSIO.

I have problems with the command line. When I run npm i @tuyapi/cli -g, I get the following error: "bash: npm: command not found" so that I cannot install npm. The same issue when running tuya-cli wizard, I get the following error: -bash: tuya-cli: command not found

What is the way to do it correctly

Thank you very much

milo526 commented 3 years ago

You are missing NPM, you will first need to install NPM (and probably node). Since you do not have NPM installed, you cannot install the Tuya-cli.

Yonny24 commented 3 years ago

Same issue here trying to add localtuya and now it requires npm. I'm scratching my head at this point.

Can you point us in the right direction please? Running Home Assistant OS 5.13

codetheweb commented 3 years ago

There are multiple ways to install Node & NPM. I recommend using nvm.

JPMurara commented 3 years ago

Hello codetheweb! I tried using the link. I just copied the command into the git bash. It did install something but the npm command still not work. Any other suggestion? Cheers.

codetheweb commented 3 years ago

You'll have to restart your shell / make a new one if you haven't already after installing nvm for it to activate. You also have to install a Node.js version after installing nvm with something like nvm install node.

JPMurara commented 3 years ago

thx guys, its working now. That's what I did:

  1. download and install node.js https://nodejs.org/en/download/ (it comes with npm)
  2. open the git terminal and type npm -v so I could see the version (6.14.15) that was installed from step 1 ...and that was it. Easy. Cheers!