floydspace/serverless-esbuild

ENOTEMPTY: directory not empty, rmdir Error

Opened this issue · 0 comments

Describe the bug
When using "serverless deploy", the bug does not happen, however once I use "serverless deploy -f" I encounter the error: "ENOTEMPTY: directory not empty, rmdir", referring to the ".esbuild.build\src" folder.

To Reproduce

  1. Run the "serverless deploy -f" command.

Expected behavior
Running "serverless deploy -f" should function the same as "serverless deploy" where code is compiled and then deployed AWS.

Screenshots or Logs
Logs:

Error:
Error: ENOTEMPTY: directory not empty, rmdir '.esbuild.build\src'
at Object.rmdirSync (node:fs:1227:10)
at _rmdirSync (node:internal/fs/rimraf:260:21)
at rimrafSync (node:internal/fs/rimraf:193:7)
at node:internal/fs/rimraf:253:9
at Array.forEach ()
at _rmdirSync (node:internal/fs/rimraf:250:7)
at rimrafSync (node:internal/fs/rimraf:193:7)
at node:internal/fs/rimraf:253:9
at Array.forEach ()
at _rmdirSync (node:internal/fs/rimraf:250:7)
at rimrafSync (node:internal/fs/rimraf:193:7)
at Object.rmSync (node:fs:1276:10)
at Object.removeSync (\node_modules\fs-extra\lib\remove\index.js:11:6)
at EsbuildServerlessPlugin.cleanup (\node_modules\serverless-esbuild\dist\index.js:344:32)
at async after:deploy:function:packageFunction (\node_modules\serverless-esbuild\dist\index.js:92:17)
at async PluginManager.runHooks (\node_modules\serverless\lib\classes\plugin-manager.js:530:9)
at async PluginManager.invoke (\node_modules\serverless\lib\classes\plugin-manager.js:565:9)
at async PluginManager.run (\node_modules\serverless\lib\classes\plugin-manager.js:604:7)
at async Serverless.run (\node_modules\serverless\lib\serverless.js:179:5)
at async \node_modules\serverless\scripts\serverless.js:829:9

Versions (please complete the following information):

  • OS: Windows
  • Serverless Framework Version: 3.32.0
  • Plugin Version: 1.45.1

Additional context

I have also tried running a custom plugin that runs before build to remove the ".esbuild" directory, but still have no luck.