5

When running sls offline start I'm getting:

$ sls offline start
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn java ENOENT
    at exports._errnoException (util.js:1020:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

My serverless.yml has:

plugins:
  - serverless-dynamodb-local
  - serverless-offline
  - serverless-mocha-plugin
iaforek
  • 2,860
  • 5
  • 40
  • 56

3 Answers3

9

Run: sls dynamodb install first and then sls offline start. The error will not appear anymore.

Credits go to: https://github.com/serverless/serverless/issues/3247

iaforek
  • 2,860
  • 5
  • 40
  • 56
  • 1
    The question is for general "how-to" fix for ENOENT-error, however, the answer is specific to dynamoDB. Please edit the answer so it can also be helpful as a general use case – Richard Miller Mar 13 '19 at 23:15
0

If you've just installed java for the fist time you will probably have to restart your computer so that the java bin is properly in your $PATH

Brian McCall
  • 1,831
  • 1
  • 18
  • 33
0

I was having issues with not having the JAVA at the first place on my machine and afterwards installing I haven't added that java in the environment variable ‍♂️. This might save someone's time as the Dynamodb is using the JAVA you need to have it in your machine.

So for installing JAVA Head to Oracle Official

and afterwards for making java accessible into your terminal checkout this one

Keyur Lakhani
  • 4,321
  • 1
  • 24
  • 35