After upgrading serverless-offline from 3.5.7 to latest version (3.8.3), I'm getting this error when attempting to start:
andre@MacBook-Pro-de-Andre api (master) $ sls offline
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn java ENOENT
at exports._errnoException (util.js:870:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:437:9)
at process._tickDomainCallback (node.js:392:17)
Hi @bazaglia
From the stack trace, I'd say it is not an error from the plugin.
Try this:
rm -rf node_modules && npm i && npm uninstall -g serverless && npm i -g serverless
If you're still getting the error, we'll dive deeper.
I'm getting the same error also after updating and tried the above to no avail
Please tell me which serverless version you're using.
It's the current version 1.3.0
I am facing the same issue as well, with installed version as ^3.8.3
Although, sls offline start works just fine.
aha! This works for me also - Thank you for the tip!
@dherault I thought from the start it was an error from plugin because it happened both in my local environment and in my continuous integration testing.
@dbunker Wow, that solved it!
Thanks @dpkshrma for the workaround, I edited the readme until we figure out how to make sls offline work again.
Got sls offline working back again. So, in my case, the cause of this issue was pretty weird.
I am using serverless-dynamodb-local along with the serverless-offline plugin, which stopped working when I started using sls offline start (not cool! :disappointed:)
So, I checked out my previous hello world projects where both were working, and discovered that in those projects, I had installed serverless-dynamodb-local in dependencies (not devDependencies) (glad I made that mistake :smile:)
Still, this needs fixing. Will try to look into what might be causing this behavior.
So, having played around with a couple of plugins, it looks like the plugins need to hook into the offline:start:init lifecycle instead of offline:start now.
See https://github.com/elastic-coders/serverless-webpack/pull/105
https://github.com/99xt/serverless-dynamodb-local/pull/77
What I was seeing was that serverless-offline would start up fine, but these other plugins that hooked into the serverless-offline lifecycle wouldn't start up properly.
Most helpful comment
I am facing the same issue as well, with installed version as ^3.8.3
Although,
sls offline startworks just fine.