Encountering a “No such file or directory” error while attempting to remove a NodeJS application via CloudLinux

Posted on

Cause:

When attempting to uninstall a NodeJS application via cPanel (Software >> NodeJS), the following error message may appear:

No such file or directory error

ERROR: [Errno 2] No such file or directory: ‘/home/cptechs/public_html/app/.htaccess’

Reason for the Error Occurrence:

This error occurs when the application directory has been deleted directly through the command line, instead of being properly uninstalled through the cPanel interface.

Solution:

To resolve this issue, follow these steps:

1: Recreate the application directory that was deleted using the following command, adjusting the path if necessary:

# mkdir -v /home/cptechs/public_html/app

Note: In this example, the application directory is assumed to be ‘/home/cptechs/public_html/app’. Make sure to modify the directory path to match your application’s location.

2: Create an empty .htaccess file within the newly recreated directory:

# touch /home/cptechs/public_html/app/.htaccess

3: Set the correct ownership of the .htaccess file to the appropriate cPanel user:

# chown cptechs:cptechs /home/cptechs/public_html/app/.htaccess