iaforek
iaforek

Reputation: 3088

ENOENT error when starting serverless offline

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

Upvotes: 5

Views: 4670

Answers (3)

Keyur Lakhani
Keyur Lakhani

Reputation: 4371

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

Upvotes: 0

Brian McCall
Brian McCall

Reputation: 1907

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

Upvotes: 0

iaforek
iaforek

Reputation: 3088

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

Upvotes: 9

Related Questions