question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENOTEMPTY error during serverless package

See original GitHub issue

This is a (Bug Report / Feature Proposal)

Bug Report

Description

While running serverless package, sometimes I see an error ENOTEMPTY: directory not empty, rmdir ‘c:<path>.webpack<path>’

For bug reports:

  • What went wrong?
  • What did you expect should have happened?
  • What was the config you used?
  • What stacktrace or error message from your provider did you see?
Serverless: Packaging service...

  Error --------------------------------------------------

  ENOTEMPTY: directory not empty, rmdir 'c:\...\.webpack\...'

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

Error: ENOTEMPTY: directory not empty, rmdir '...\.webpack\...'
    at Object.fs.rmdirSync (fs.js:846:18)
    at rmkidsSync (c:\...\node_modules\serverless-webpack\node_modules\fs-extra\lib\remove\rimraf.js:304:27)
    at rmdirSync (c:\...\node_modules\serverless-webpack\node_modules\fs-extra\lib\remove\rimraf.js:281:7)
    at rimrafSync (c:\...\node_modules\serverless-webpack\node_modules\fs-extra\lib\remove\rimraf.js:252:7)
    at options.readdirSync.forEach.f (c:\...\node_modules\serverless-webpack\node_modules\fs-extra\lib\remove\rimraf.js:291:39)
    at Array.forEach (<anonymous>)
    at rmkidsSync (c:\...\node_modules\serverless-webpack\node_modules\fs-extra\lib\remove\rimraf.js:291:26)
    at rmdirSync (c:\...\node_modules\serverless-webpack\node_modules\fs-extra\lib\remove\rimraf.js:281:7)
    at Object.rimrafSync (c:\...\node_modules\serverless-webpack\node_modules\fs-extra\lib\remove\rimraf.js:252:7)
    at ServerlessWebpack.cleanup (c:\...\node_modules\serverless-webpack\lib\cleanup.js:13:11)
From previous event:
    at PluginManager.invoke (C:\Users\...\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:22)
    at PluginManager.run (C:\Users\...\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:421:17)
    at variables.populateService.then.then (C:\Users\...\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:157:33)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at Serverless.run (C:\Users\...\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:144:8)
    at serverless.init.then (C:\Users\...\AppData\Roaming\npm\node_modules\serverless\bin\serverless:43:50)
    at <anonymous>

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     win32
     Node Version:           8.12.0
     Serverless Version:     1.32.0

For feature proposals:

  • What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
  • If there is additional config how would it look

Similar or dependent issue(s):

Additional Data

  • Serverless-Webpack Version you’re using: 5.2.0
  • Webpack version you’re using: 4.20.2
  • Serverless Framework Version you’re using: 1.32.0
  • Operating System: Windows
  • Stack Trace (if available): Above

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
ariel-frischercommented, Mar 4, 2021

I’m getting this without serverless webpack…

2reactions
mwoodsmallcommented, Aug 14, 2019

It is happening when trying to cleanup the output directory, so a workaround is to set this in your serverless.yml file:

custom:
  webpack:
    keepOutputDirectory: true

With that set it won’t attempt to cleanup the .webpack directory

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 >
serverless/serverless - Gitter
Been using serverless-webpack for months now, and i am running into the following error recently: Serverless: Packaging service.
Read more >
Weird issue after running update version is not showing as u | Sst ...
Hey @Michael Robellard, do u recall if the version in package.json ... When I ran npm install I get an error: npm ERR!...
Read more >
Setting Up Serverless Framework With AWS
Get started with Serverless Framework's open-source CLI and AWS in minutes. Installation. Install the serverless CLI via NPM:
Read more >
NPM install error - Material Design for Bootstrap
Delete node_modules folder and package-json.lock; Then run npm i; If problem still exists repeat point 1 and go to 4 point; Update npm...
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