ENOENT error when starting serverless offline

Viewed 4200

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
3 Answers

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

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

Related