ENOTEMPTY: directory not empty, rename ' -> ' (JavaScript + NPM + Ubuntu server)

Posted on Jun 16, 2023

Question

Alright, so I've been making a bot for a popular Teamspeak-like program called discord. I'm running the bot on an Ubuntu server, and use NPM install to install various modules.

Currently, the local version of the bot works fine, but on Ubuntu I can't seem to do "sudo npm install urban" (Urban being the only module I'm having problems with - https://www.npmjs.com/package/urban )

The error I get is

npm ERR! Linux 4.2.0-27-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "urban"
npm ERR! node v5.6.0
npm ERR! npm  v3.6.0
npm ERR! path /var/www/chatbot/node_modules/urban
npm ERR! code ENOTEMPTY
npm ERR! errno -39
npm ERR! syscall rename
npm ERR! ENOTEMPTY: directory not empty, rename '/var/www/chatbot/node_modules/urban' -> '/var/www/chatbot/node_modules/.urban.DELETE'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request: npm ERR! /var/www/chatbot/npm-debug.log

When I cd to the node_modules folder and do ls, there isn't even an urban folder I could work with.

I am relatively new to programming, so I'm sorry if I missed anything, I'll gladly add more information if needed. Thanks in advance, guys.

Answer

I simply deleted the node_modules folder and ran npm install again ;)