Share via

cannot move 'node_modules' to '_del_node_modules/node_modules': Permission denied

Graham 86 Reputation points
2026-01-17T20:31:02.37+00:00

I've noticed the following error in my node.js App Service Linux App on startup:

"mv: cannot move 'node_modules' to '_del_node_modules/node_modules': Permission denied"

The app normally starts up fine but recently I updated a package version in package.json and the app would not start up because the new package was not getting installed.

Upon investigating I found that the the node_modules.tar.gz archive was getting updated, but not the node_modules folder that node.js actually reads from. It looks like the startup script that is supposed to unzip node_modules and copy them to the correct folder is failing with permission denied.

I'm not quite sure how to fix this. I was able to mitigate it by connecting via ssh and manually running npm install in wwwroot. This makes sure node_modules has up-to-date packages but does not seem like a viable long-term solution for process that is supposed to be automated.

I do have another Linux Web App and I connected to both via ssh, ran ls -l, and noticed that both node_modules and _del_node_modules are both supposed to be symbolic links and not directories. For some reason on my broken app they are directories.

I'm not sure how to fix this aside from maybe deleting the entire app and recreating from scratch. Any help would be appreciated.

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.

0 comments No comments

Answer accepted by question author

Michele Ariis 7,210 Reputation points MVP Volunteer Moderator
2026-01-18T14:34:34.2533333+00:00

Hi, this happens because node_modules and _del_node_modules stopped being symlinks and became real folders. When that happens, the App Service startup script can’t move them and fails with “permission denied”.

The fix is to SSH into the app, delete both node_modules and _del_node_modules, then restart or redeploy the app. App Service will recreate them as symlinks and package installs will work again.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.