If you are getting an error message saying that the “npm” command is not found when you try to run it in cPanel, it is likely because npm is not installed on your system or is not in your PATH. Here are some steps you can try to fix this issue:
- Make sure that npm is installed on your system. You can check if npm is installed by running the following command:
If npm is installed, this command will print the version number of npm. If the command is not found, then npm is not installed on your system.
- If npm is not installed, you can try installing it by running the following command:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
This will install the Node Version Manager (nvm), which allows you to install and manage multiple versions of Node.js and npm.
- After installing nvm, you can install the latest version of Node.js and npm by running the following command:
nvm install node
- If npm is installed but is not in your PATH, you can try adding it to your PATH by modifying your environment variables. Here are the steps to do this on a cPanel server:
- Log in to cPanel and go to the “Software” section.
- Click on the “Set Python Path” button.
- In the “Python Path” field, enter the path to the npm executable. This is typically something like “/usr/local/bin/npm”.
- Click the “Update” button to save your changes.
After making these changes, try running the “npm” command again. It should now work as expected.
I hope these steps help! Let me know if you have any questions.
Last modified: January 13, 2023