18

running on Mac, I've created a basic serverless service using the aws-nodejs template:

serverless create --template aws-nodejs --path TestService

After that I used the following commands to add serverless local:

npm install serverless-dynamodb-local
serverless dynamodb install

No matter what I do, I can't get dynamodb-local to start. When I run

serverless dynamodb start

I get the following error:

Error: spawn java ENOENT
at _errnoException (util.js:992:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)

Running java --version gives me the following info:

Java 10.0.2 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

I'm using Node 8.11.4 with serverless 1.30.1. Aws-sdk is also installed and I've setup my profile.

Thanks

Nahum Bazes
  • 610
  • 1
  • 6
  • 15

4 Answers4

36

Apparently there is a bug with version serverless-dynamodb-local@0.2.31.

issue on github

I've downgraded to version 0.2.30 by using

npm uninstall serverless-dynamodb-local
sls dynamodb uninstall

npm install serverless-dynamodb-local@0.2.30
sls dynamodb install
Nahum Bazes
  • 610
  • 1
  • 6
  • 15
  • This should be the accepted answer. Missed this among all the issues on Github: / – Juvaly Aug 21 '18 at 14:11
  • Tried a bunch of solutions, but only this one worked. Thank you! – Myroslav Hryshyn Aug 21 '18 at 14:16
  • Hopefully that plugin gets updated soon. This was hard to find a fix for. Thanks! – Jordan Aug 30 '18 at 03:52
  • 3
    FYI, I have had `^0.2.35` installed with no problems until today. Turns out `0.2.36` was just released and has the same problem. I am staying on `0.2.35` for the time being and removed the carrot in my `package.json` – Roustalski Jan 28 '19 at 20:33
  • 1
    I was on `0.2.38` and saw this problem, downgrading to `0.2.37` fixed it... – hwjp Dec 10 '19 at 11:29
5

Following the advice on serverless-dynamodb-local/issues/195, I just ran sls dynamodb install --localPath ./bin and Dynamodb installed correctly. Running serverless offline start then worked without error.

MarkC
  • 156
  • 1
  • 9
3

Make sure you have installed jre to run dynamodb jar. Otherwise this error will be thrown.

Dinuka Salwathura
  • 924
  • 16
  • 33
0

In my opinion it's better to go with "serverless-dynamodb" instead of "serverless-dynamodb-local". Actually that's a fork from dynamodb-local only. Here is the documentation for migrating it.

https://github.com/raisenational/serverless-dynamodb#migrating-from-serverless-dynamodb-local

You need java installed in your system in both of the case. Use this command if you're a ubuntu user for installing java.

sudo apt-get install openjdk-8-jdk

Need to setup java home env variable as well.

Arjun G
  • 2,194
  • 1
  • 18
  • 19