
If you see the “Can’t acquire lock for an app:” error message, this probably means that some processes use the “.lock” file of your NodeJS application.
This usually happens because a daemon script was previously started via NodeJS Selector -> Run NPM Script.
When you start a script this way, you have no way of stopping it via UI.
Moreover, it keeps running in the background holding a lock for the application. That is why when you try to perform any actions with an App after starting such a daemon script, you get “Can’t acquire lock for app” error.
Solution
To solve the problem, you need to do the following:
- Connect to your server over SSH as root and run the lsof command:
lsof -u username | grep lock - You should see a list of lock processes that you will need to kill (where XXXXXX is the process number):kill -9 XXXXXX
If you have multiple processes, you may list their IDs.
To stop this coming back, don’t launch daemon scripts through the Node.js Selector UI. Run them under a process manager instead. If your app needs a long-running daemon (a bot, a websocket server, a queue worker), shared hosting’s Selector isn’t the right tool: a BDIX VPS with full root access lets you run PM2 or systemd services properly, and you can kill stuck processes yourself without waiting for support. For a normal web app, see how to install a Node.js app in cPanel the supported way.
If you’re hosted with us, you can also open a support ticket and we’ll clear the locked process for you.
Why this happens
CloudLinux’s Node.js Selector creates a .lock file in your application directory every time it performs an action (start, stop, restart, NPM install). The lock guarantees only one operation touches the app at a time. Normally the lock is released when the action finishes, but a daemon script launched through Run JS Script never finishes. It keeps running in the background, holds the lock indefinitely, and the Selector UI has no button to stop it. Every action you try after that fails with Can't acquire lock for app: %(app)s.
If killing the process doesn’t fix it
Occasionally the process is already dead but the stale .lock file remains. Check your application directory and remove it manually:
ls -la /home/username/appdirectory/ | grep lockrm /home/username/appdirectory/.lock
Then restart the app from the Selector UI. If the error returns immediately, a cron job or startup script is relaunching the daemon: check crontab -l for the user.
Hitting a different Selector problem? See Node.js Selector page stuck on loading or the Apache Passenger is required by Node.js Selector error.