serverless: Cannot deploy Python project with standalone on Windows

I am following the getting started hello-world example using the aws-python3 template, but I keep getting errors about:

Error: ENOENT: no such file or directory, copyfile 'C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\sdk-py\serverless_sdk\__init__.py'

Seems like I am not the only one. Here is a serverless forum post with no traction: failure-to-deploy-or-run-locally-with-file-not-found-exception

No plugins were installed.

serverless.yml
service: helloworld
app: helloworldtest
org: kennedy

provider:
  name: aws
  runtime: python3.8


functions:
  hello:
    handler: handler.hello
handler.py
import json


def hello(event, context):
    body = {
        "message": "Go Serverless v1.0! Your function executed successfully!",
        "input": event
    }

    response = {
        "statusCode": 200,
        "body": json.dumps(body)
    }

    return response
CLI output
  Error --------------------------------------------------

  Error: ENOENT: no such file or directory, copyfile 'C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\sdk-py\serverless_sdk\__init__.py' -> 'C:\Users\Kennedy\Documents\projects\serverless\helloworld\serverless_sdk\__init__.py'
      at copyFileSync (fs.js:1807:3)
      at Object.copyFileSync (C:\snapshot\serverless\lib\utils\standalone-patch.js:53:5)
      at copyFile (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:68:8)
      at onFile (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:53:25)
      at getStats (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:48:44)
      at startCopy (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:38:10)
      at copyDirItem (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:120:10)
      at C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:113:39
      at Array.forEach (<anonymous>)
      at copyDir (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:113:23)
      at onDir (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:103:10)
      at getStats (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:45:37)
      at startCopy (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:38:10)
      at handleFilterAndCopy (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:33:10)
      at Object.copySync (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\node_modules\fs-extra\lib\copy-sync\copy-sync.js:26:10)
      at C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\lib\wrap.js:313:10
      at Generator.next (<anonymous>)
      at asyncGeneratorStep (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\lib\wrap.js:8:103)
      at _next (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\lib\wrap.js:10:194)
      at C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\lib\wrap.js:10:364
      at new Promise (<anonymous>)
      at C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\lib\wrap.js:10:97
      at wrap (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\lib\wrap.js:387:17)
      at ServerlessEnterprisePlugin.<anonymous> (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\lib\plugin.js:446:17)
      at Generator.next (<anonymous>)
      at asyncGeneratorStep (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\lib\plugin.js:3:103)
      at _next (C:\snapshot\serverless\node_modules\@serverless\enterprise-plugin\lib\plugin.js:5:194)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

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

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

  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              12.16.1
     Framework Version:         1.69.0 (standalone)
     Plugin Version:            3.6.8
     SDK Version:               2.3.0
     Components Version:        2.30.2

Installed version

Framework Core: 1.69.0 (standalone)
Plugin: 3.6.8
SDK: 2.3.0
Components: 2.30.2

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

It’s wierd that it attempts to access files needed for local invocation.

Did it work for you with older versions of standalone build?

I’ve reproduced it on Windows (it appears as specific to this OS)

Forgive me, I do not understand. Is the solution not to use monitoring? Is this a known bug during deploy?

@kennedy I understand that command is: serverless invoke local --function hello ? (description and CLI output doesn’t state what command was invoked)

@medikoo the command I was running was serverless deploy just like the example/tutorial, I was presented with that error.

When I attempt to serverless deploy with org and app configured in the serverless.yaml, it creates an empty directory called serverless_sdk. According to this framework documentation its a module I would import, but its empty.


I’ve been running into this same error as well. A workaround that seems to be working for me is to not enable the “You can monitor, troubleshoot. and test your new service with a free Serverless account” when setting up a new project

@Micron-Flash I confirm I wont get this error if I don’t use the free monitoring and dashboard. Though, I would like to use it. Seems like a bug some where.


Duplicate of #7407

Unfortunately this situation is not the same. @adimango issue wasnt about deploys