TL;DR: Download the Java SDK, then manually add the path to your environment variables.
"My middle name is Edge Case," I joked, my hand the only one raised in a room of about 100 people. At that moment, I was the only person still unable to get amplify mock api
to work on the command line.
The problem? No java:
Easy fix. I found what I thought would be the right npm
package and blithely hit Enter
.
I got back a wall of error messages, mostly having to do with gyp
missing Python
:
Thankfully, somebody nearby was having a similar issue and had just solved it by downloading the Java SDK directly from Oracle.
I grabbed the Windows version, installed it, and ran amplify mock api
again. Again, it told me I had no java.
I went into Programs and checked. There it was, happily ensconced between Internet Explorer (huh?) and Killer Networking (uhm... huh?).
Maybe it was telling me I needed more coffee? I tried that. No luck.
But then something clicked. I remembered similar issue I'd ran into during boot camp (the only Windows 10 user in my class). The solution then was to manually enter the path into Environment Variables.
To try that, I went to the Control Panel\System and Security\System and clicked on Advanced system settings.
In the System Properties/Advanced panel that opened, I clicked on Environment Variables.
That took me to the panel with User
and System
variables, both including the option to add a new Path
.
I first selected the User variables Path
and clicked on Edit
. That took me to the Edit environment variable panel with an option to add a new Path
.
To make sure I entered the path correctly, I used the File Explorer to navigate into the bin
folder for Java
, then right clicked on the address to copy it.
I copied and pasted it into both User
and System
Path variables, and clicked OK
.
After that, I kept clicking OK
until I was out of the Control Panel. Then, for the changes to register with the CLI, I had to close and reopen it again. Finally, I ran amplify mock api
one more time...
It worked!
And so, at long last, I could carry on with the workshop, building real-time offline-ready applications with React, GraphQL & AWS AppSync.
Top comments (1)
This helped me. Thank you Cameron! Watching the video upload, youtube.com/watch?v=HZUlQ7Z2xHQ to gain mastery over AWS & Amplify.