Categories
JavaScript Answers

How to fix sudo node command not found, but node without sudo is working on EC2?

Spread the love

To fix sudo node command not found, but node without sudo is working on EC2, we add some symlinks as an admin.

We run

sudo ln -s /usr/local/bin/node /usr/bin/node
sudo ln -s /usr/local/lib/node /usr/lib/node
sudo ln -s /usr/local/bin/npm /usr/bin/npm
sudo ln -s /usr/local/bin/node-waf /usr/bin/node-waf

to add the symlinks for the directories for the Node.js paths in our EC2 virtual machine to run Node as root.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *