npm command not found - Amazon Linux
Page content
How to Install npm Command on Amazon Linux
When working with Amazon Linux, you may encounter the issue of the npm command not being found. npm is a package manager for JavaScript programming language. In order to use it on Amazon Linux, you need to install Node.js, which comes with npm bundled.
Installation Steps
- Update your package repository index:
sudo yum update
- Install Node.js and npm:
sudo yum install nodejs
- Verify the installation by checking the versions of Node.js and npm:
node -v
npm -v
Troubleshooting
If the npm command is still not found after installing Node.js, it may be due to the binary not being in your system’s PATH. You can create a symbolic link to make it accessible:
sudo ln -s /usr/bin/node /usr/bin/npm
This will create a symbolic link from the node binary to the npm binary, allowing you to use npm without any issues.
Conclusion
By following these steps, you should now have successfully installed the npm command on your Amazon Linux system. You can now use npm to manage packages and dependencies for your JavaScript projects.