ENOTEMPTY NPM error

I haven’t touched my site for long time and for some reason it stopped working, I went to the project editor and I found that all of my node_modules are missing, I tried installing the dependencies but I got greeted with this error, how can I fix this? I am not experienced when comes to Glitch’s file system.

$ npm install next
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /app/node_modules/aria-query
npm ERR! dest /app/node_modules/.aria-query-XqN2ojv5
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename '/app/node_modules/aria-query' -> '/app/node_modules/.aria-query-XqN2ojv5'

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npm-cache/16.14.2/_logs/2022-11-29T05_36_02_877Z-debug.log

Glitch does some funny things to NPM and node_modules and breaks my site out of nowhere for no good reason even though I haven’t touched in months is beyond frustrating and I have no more energy to fight with Glitch because it will happen again sooner or later. I experienced the same issue like more than 10 times just to end up fighting with Glitch for days!

I don’t know when but Glitch broke all the packages because it cannot find the next command.

/opt/watcher/app-types/node/start.sh: line 51: next: command not found

As a person with at least one functioning brain cell I decided to install next.

$ npm install next
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /app/node_modules/aria-query
npm ERR! dest /app/node_modules/.aria-query-XqN2ojv5
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename '/app/node_modules/aria-query' -> '/app/node_modules/.aria-query-XqN2ojv5'

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npm-cache/16.14.2/_logs/2022-12-20T03_25_22_670Z-debug.log

When I noticed this strange error I already knew that I will have to put up a fight with Glitch once again; I decided to get rid of node_modules, clear git cache, and refresh to try with clean installation.

$ rm -rf node_modules
$ git prune
$ git gc
$ refresh

After refresh I tried to use re-install NPM packages:

$ npm install

Once again, same error as I shown above with npm install next. I am losing my patience!

It’s been months and this still has not been resolved :face_with_thermometer:

Hey there - can you send an email to support@glitch.com with the project name and this info. We can take a look!

1 Like