Error: ENOTEMPTY: directory not empty

See original GitHub issue

Pretty regularly, I see the following error when starting webpack. My dist folder is typically a few folders deep. I usually just run webpack again and it works fine, but I thought I’d log an issue in case anyone else is seeing this as well:

C:\path\to\project\node_modules\webpack-dev-server\bin\webpack-dev-server.js:345
                throw e;
                ^

Error: ENOTEMPTY: directory not empty, rmdir 'C:\path\to\project\dist\Views'
    at Object.fs.rmdirSync (fs.js:856:18)
    at rmkidsSync (C:\path\to\project\node_modules\clean-webpack-plugin\node_modules\rimraf\rimraf.js:342:11)
    at rmdirSync (C:\path\to\project\node_modules\clean-webpack-plugin\node_modules\rimraf\rimraf.js:332:7)
    at rimrafSync (C:\path\to\project\node_modules\clean-webpack-plugin\node_modules\rimraf\rimraf.js:303:9)
    at C:\path\to\project\node_modules\clean-webpack-plugin\node_modules\rimraf\rimraf.js:340:5
    at Array.forEach (native)
    at rmkidsSync (C:\path\to\project\node_modules\clean-webpack-plugin\node_modules\rimraf\rimraf.js:339:26)
    at rmdirSync (C:\path\to\project\node_modules\clean-webpack-plugin\node_modules\rimraf\rimraf.js:332:7)
    at Function.rimrafSync [as sync] (C:\path\to\project\node_modules\clean-webpack-plugin\node_modules\rimraf\rimraf.js:303:9)
    at C:\path\to\project\node_modules\clean-webpack-plugin\index.js:164:16
    at Array.forEach (native)
    at CleanWebpackPlugin.clean (C:\path\to\project\node_modules\clean-webpack-plugin\index.js:90:15)
    at CleanWebpackPlugin.apply (C:\path\to\project\node_modules\clean-webpack-plugin\index.js:191:20)
    at Compiler.apply (C:\path\to\project\node_modules\tapable\lib\Tapable.js:306:16)
    at webpack (C:\path\to\project\node_modules\webpack\lib\webpack.js:32:19)
    at startDevServer (C:\path\to\project\node_modules\webpack-dev-server\bin\webpack-dev-server.js:339:14)
    at C:\path\to\project\node_modules\webpack-dev-server\bin\webpack-dev-server.js:330:3
    at C:\path\to\project\node_modules\portfinder\lib\portfinder.js:160:14
    at C:\path\to\project\node_modules\portfinder\node_modules\async\lib\async.js:52:16
    at C:\path\to\project\node_modules\portfinder\node_modules\async\lib\async.js:269:32
    at C:\path\to\project\node_modules\portfinder\node_modules\async\lib\async.js:44:16
    at C:\path\to\project\node_modules\portfinder\lib\portfinder.js:122:16
error Command failed with exit code 1.

OS: Windows 10 clean-webpack-plugin version: 0.1.16 rimraf version: 2.5.4

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:37
  • Comments:33 (1 by maintainers)

github_iconTop GitHub Comments

33reactions
Legendscommented, Aug 6, 2018

One reason could be, if you have live server extension installed ???

When I disable it, the error goes away… image

33reactions
johnagancommented, Aug 11, 2017

A quick search for the error seems to indicate that “it was due to the fact I had an explorer window opened in the directory I was trying to delete”. Could this be the case here as well?

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm install error ENOTEMPTY: directory not empty
It seems like the error "npm install error ENOTEMPTY" is happening when the npm try to write to a folder that is not...
Read more >
Remove a directory that is not empty in NodeJS - Geedew
This unfortunately means that it will error ENOTEMPTY if there is any file in the directory you are attempting to remove.
Read more >
Error getting ENOTEMPTY directory not empty rmdir error on ...
I am creating my first MEAN app. I have installed angular CLI and also tested it using ng serve -o this command then...
Read more >
ENOTEMPTY when installing node from palette since nodered ...
ENOTEMPTY : directory not empty, rename '/data/node_modules/marked' -> '/data/node_modules/.marked-zxF1Vjah' ... I receive similar ENOTEMPTY errors for both:
Read more >
“Error: ENOTEMPTY: directory not empty, rmdir .next\static ...
“Error: ENOTEMPTY: directory not empty, rmdir .next\static” Code Answer ... To remove a non-empty directory use: 6. rm -r *directory name*.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found