Reputation: 630
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
Upvotes: 18
Views: 15199
Reputation: 5260
serverless-dynamodb-offline seems to be unmaintained now. Swapping to serverless-dynamodb worked for me, as per this comment
Upvotes: 0
Reputation: 2294
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.
Upvotes: 1
Reputation: 944
Make sure you have installed jre to run dynamodb jar. Otherwise this error will be thrown.
Upvotes: 3
Reputation: 185
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.
Upvotes: 5
Reputation: 630
Apparently there is a bug with version [email protected].
I've downgraded to version 0.2.30 by using
npm uninstall serverless-dynamodb-local
sls dynamodb uninstall
npm install [email protected]
sls dynamodb install
Upvotes: 36