Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: ENOTEMPTY: directory not empty #59

Closed
dougludlow opened this issue Jun 12, 2017 · 33 comments · Fixed by #64
Closed

Error: ENOTEMPTY: directory not empty #59

dougludlow opened this issue Jun 12, 2017 · 33 comments · Fixed by #64

Comments

@dougludlow
Copy link

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

@rebolyte
Copy link

I'm hitting this issue as well, but only intermittently. It seems to empty the specified folder(s) and then throws the error. Then on running the build again it removes the now-empty directory successfully.

@brianespinosa
Copy link

I encounter this issue intermittently as well. Running the build again does not fix the issue. Usually have to manually delete the folder and run again.

@webpepper
Copy link

I've been noticing this as well lately after a bunch of things were upgraded (typescript, webpack, npm, etc.)

Current config:

node: v7.10.0
npm: 5.3.0
webpack: 3.4.1

@sergeysolovev
Copy link

The same for me, seems to be an issue with CleanWebpackPlugin

node v8.2.1
npm v5.3.0
webpack 3.5.1

@johnagan
Copy link
Owner

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?

@webpepper
Copy link

webpepper commented Aug 15, 2017

Updating the version of rimraf in dependencies may help resolve the issue.

~2.5.1 will only bump it up to 2.5.4, and in version 2.6.0 this ENOTEMPTY error was addressed:
isaacs/rimraf@d53235d

After updating rimraf's version 2-3 days ago I haven't seen this error. Before that things were exploding left and right.

@wcxaaa
Copy link

wcxaaa commented Oct 11, 2017

Hi! I find this error occurs when nodemon is on.

OS: Windows10 15063's WSL (Ubuntu 16.04)

@chrisblossom
Copy link
Collaborator

@wcxaaa have you updated this plugin to version 0.1.17 ?

@wcxaaa
Copy link

wcxaaa commented Oct 13, 2017

@chrisblossom Yes I have.

chatroom-node@0.1.0 /mnt/m/workbench/_WSL/chatroom-node
└── clean-webpack-plugin@0.1.17

When I start building server code while nodemon is on, it throws an error.

Error: ENOTEMPTY: directory not empty, rmdir '/mnt/m/workbench/_WSL/chatroom-node/dist/server/config' ...

Here is the full error log.

However, the error goes away when I shut nodemon down and build again.

@chrisblossom chrisblossom reopened this Oct 14, 2017
@chrisblossom
Copy link
Collaborator

@wcxaaa is it possible for you to test if the issue is with https://github.com/isaacs/rimraf? Or at least make a minimal repository that displays the issue?

@wcxaaa
Copy link

wcxaaa commented Oct 16, 2017

I've created a minimal repo as you said to expose the error:
wcxaaa/_test-At-clean-webpack-plugin
.. in which both clean-webpack-plugin and rimraf complain about it when nodemon is started.

To make them complain, after npm install, you can just run npm run build , npm run serve and once again (in a second terminal) npm run build.

Clean-webpack-plugin now throws an error as displayed in this issue. Additionally, running npm run clear right now to initiate rimraf cleaning throws a similar error as well:

Error: ENOTEMPTY: directory not empty, rmdir 'dist'

@stereokai
Copy link

stereokai commented Jan 17, 2018

@chrisblossom @johnagan

Hi, what's going with this? Started experiencing this myself with the latest version of the plugin (0.1.17)

This issue might be related:
isaacs/rimraf#119

@chrisblossom
Copy link
Collaborator

Sorry, I have not had time to setup a local Windows VM. Although, I do think this particular issue is with isaacs/rimraf and not this plugin.

@stereokai
Copy link

I couldn't find yet what is causing it. I did comment on the issue I linked to from the rimraf repo, let's see.

Thanks for such a quick reply.

@dlo
Copy link

dlo commented Mar 10, 2018

In case it's helpful for anyone else, it turns out I'd run webpack under sudo, so files created in dist had root permissions and my usual user didn't have the rights to delete them. This is why running webpack would throw this error (at least for me).

@chrisblossom
Copy link
Collaborator

@dlo I would highly suggest NOT running webpack with sudo. If you are experiencing permission issues without sudo you have other issues that should be solved. Again, running webpack as sudo is dangerous and should be avoided.

@dlo
Copy link

dlo commented Mar 10, 2018

No argument here. It wasn't purposeful--I ran foreman under sudo and webpack was one of the commands in the Procfile. It wasn't intentional.

@Legends
Copy link

Legends commented Aug 5, 2018

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

When I disable it, the error goes away...
image

@wzhudev
Copy link

wzhudev commented Jan 16, 2019

NTFS is shit. I guess this is inevitable for Windows users and nothing to do with this plugin or its dependencies.

@ChiKaLiO
Copy link

i'm just a noob but after running ng build for the third time it worked ._. ..

@shobhit-v
Copy link

npm install

fixed my issue

@stereokai
Copy link

@shobhit-v what're your package.json contents?

@shobhit-v
Copy link

@stereokai

{
"name": "quotation-manager",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "node server.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"heroku-postbuild": "ng build --prod"
},
"private": true,
"dependencies": {
"@angular/animations": "~7.2.0",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-free-webfonts": "^1.0.9",
"@fortawesome/fontawesome-svg-core": "^1.2.8",
"@fortawesome/free-solid-svg-icons": "^5.5.0",
"core-js": "^2.5.4",
"express": "^4.16.4",
"font-awesome": "^4.7.0",
"path": "^0.12.7",
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",
"@angular/cli": "~7.3.0",
"@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "~7.2.0",
"@fortawesome/fontawesome-free": "^5.7.2",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2"
},
"engines": {
"node": "10.15.1",
"npm": "6.4.1"
},
}

@stereokai
Copy link

@shobhit-v Thanks, though doesn't help me much, they're all top level deps.

@chrisblossom
Copy link
Collaborator

Closed in v2.0.0 via #99. See johnagan/clean-webpack-plugin#usage. Please open a new issue if you continue to have problems.

@mkalantar
Copy link

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

When I disable it, the error goes away...
image

you saved my day.

@ya332
Copy link

ya332 commented Feb 26, 2020

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

When I disable it, the error goes away...
image

This fixed the issue for me.

@vestemeansorin91
Copy link

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

When I disable it, the error goes away...
image

You are a GOD or something?

@xeroxstar
Copy link

I am getting same error using webpack on windows with the webstome, the version of the clean-webpack-plugin is 3.0.0, it was working fine for few hours and after webpack started to throw an error Error: ENOTEMPTY: directory not empty.

@theprantadutta
Copy link

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

When I disable it, the error goes away...
image

How on earth did you find that error?
Thanks a lot for that. This fixed the issue for me.

@claranceliberi
Copy link

Hi! I find this error occurs when nodemon is on.

OS: Windows10 15063's WSL (Ubuntu 16.04)

saved my day

@MrBrN197
Copy link

MrBrN197 commented Feb 9, 2021

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

When I disable it, the error goes away...
image

Thanks a bunch!!!!!!

@anupjungkarki
Copy link

By Uninstalling the live server extension I solve It.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.