How To Fix NodeJS Selector Not Working With An Error Can't acquire lock for app

Fix the NodeJS Selector error 'Can't acquire lock for app' in CloudLinux. Step-by-step guide to resolve lock issues and get NodeJS apps working again

How To Fix NodeJS Selector Not Working With An Error Can't acquire lock for app

❌ Fix: "Can't Acquire Lock for an App" Error in Node.js Selector (CloudLinux)

When using CloudLinux's Node.js Selector, you might encounter the following error:

"Can't acquire lock for an app"

This typically occurs when a background process or daemon script (previously started via Node.js Selector → "Run NPM Script") continues to run in the background and holds a .lock file.


🔍 Why This Happens

  • A script was started using Run NPM Script.

  • That script keeps running in the background.

  • It holds a lock on the app, preventing new actions like start/stop/configuration changes.

  • You can’t stop it from the UI — only from the command line.


🛠️ Solution: Kill the Locking Process

✅ Step 1: Find Lock Processes

Run the following command as root, replacing username with the actual cPanel username:

# lsof -u username | grep lock 

You should see output similar to:

# node 123456 username /home/username/nodeapp/tmp/.lock 

🛑 Step 2: Kill the Process Holding the Lock

Use the process ID (e.g., 123456) from the above output:

# kill -9 123456

Repeat this for all listed processes that are holding lock files.


🔁 Step 3: Retry the Action in Node.js Selector

Now go back to the cPanel → Node.js Selector, and you should be able to manage the application normally (start, stop, restart, etc.).


📌 Optional Tip:

To prevent this issue in the future:

  • Avoid using "Run NPM Script" to start long-running/daemon processes.

  • Instead, start your app using npm start inside the terminal or integrate with PM2 or systemd for better process management.

Share

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0