Tutorial: Local Cloud on Windows [25 July 2014]

Hello there!

Interested in running your own :spark: Local :cloud: but the github repo looks intimidating? Here’s a step by step guide written just for you :smile:

It is highly recommended that you do not skip the steps or deviate from the instructions as installing on Windows is a challenging due to the number of dependencies!


1.) DFU-util

Follow the instructions here to install DFU-util driver: https://community.spark.io/t/tutorial-installing-dfu-driver-on-windows/3518

Download DFU-util from: http://dfu-util.gnumonks.org/releases/dfu-util-0.7-binaries.7z

Place the dfu-util.exe in a directory you prefer. Remember where you placed it

2.) Spark-CLI

Note: Install ONLY 32 bit software

Follow this tutorial for the installation of Spark-cli: https://community.spark.io/t/tutorial-spark-cli-on-windows-04-july-2014/3112

This will include installation of `OpenSSL(normal) and Node.js which is also needed by the Local :cloud:

3.) Github command-line

Download from: https://windows.github.com/ and install

4.) Python [2.7.x]

Download from: https://www.python.org/downloads/windows/ and install.

Make sure that the version is only 2.7.x

5.) Visual C++ 2010 Express

Download from: http://go.microsoft.com/?linkid=9709949 and install.

6.) Adding OpenSSL and DFU-util to CMD Path

NOTE: this will require changing a Windows setting so please so not proceed if you feel uncomfortable doing so

  • go to My Computer and click on System Properties

  • click on Advanced system settings on the left

  • click on Environment Variables

  • look for the variable PATH and hit edit

Copy the full variable value as backup and save it somewhere

  • Add in the following at the end of the value:
  ;C:\OpenSSL-Win32\bin;PATH_TO_DFU_UTIL_EXE
          make sure u change this  ^^^^

Time to install Local :cloud:!

  1. Install the Local :cloud:

    I would recommend using the git command line or even node.js command line
  • cd to the directory you want to save the files in
  • Clone the repo with: git clone https://github.com/spark/spark-server.git
  • cd spark-server/js
  • npm install
  • node main.js

Congratulations! Your Local :cloud: should be running with the following shown on the CMD


Good Job! :hand: :smiley:

Next step will be to Setup the Local :cloud: for the 1st time: https://community.spark.io/t/tutorial-local-cloud-1st-time-instructions/5589

kennethlimcp

9 Likes

Thank you @kennethlimcp, this is awesome!

2 Likes

Great tutorial @kennethlimcp!

1 Like

Alriight! It’s working now :smile:

I really want to high five that little :hand:!

2 Likes

Hi @kennethlimcp
Thanks for putting together this tutorial. Local cloud sounds exciting. I am curious to give it a shot. I am noob at this and followed your tutorial as a script. I ran into trouble in the last step with installing the cloud. When I use git command line, it gives me an error with npm (npm.cmd not found). When using node.js command line, I get the following errors:

152 error Failed using git.
152 error This is most likely not a problem with npm itself.
152 error Please check if you have git installed and in your PATH.
153 error System Windows_NT 6.1.7601
154 error command “C:\Program Files\nodejs\\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” "install"
155 error cwd C:\Users\rahilj\Desktop\spark_core\spark-server\js
156 error node -v v0.10.29
157 error npm -v 1.4.14
158 error code ENOGIT

I am not sure whats wrong and it’s probably something trivial. I have github windows installed. I manually added it to path too after seeing the error, but that doesn’t help. I also have the node.js library for git. I am using windows 7 (32 bit) if that matters.

Any insights from more experienced people would be very much appreciated.

Thanks in advance.

Hi @rahilj,

Which command are you trying to run exactly?

Thanks!
David

Hi @Dave
Thanks for replying. I get the error during the last step: instal the local cloud. The command is npm install.

OH! if it is just the last step causing a problem, try launching the “node.js command prompt” (it’s like cmd.exe but through node.js) and try the command from there. This worked for me like a charm.

Maybe I can put together a tutorial for this, but essentially you will want to make sure you have Windows SDK 7 (or 7.1) installed and then install the Microsoft visual C++ 2008 (and 2010) express redistributable. This will help node.js, node package manager (npm) and git chug along on Windows.

1 Like

Thanks @Elijah. I will try doing that and report back tonight.

Hi @Elijah, I tried your approach but to no avail. Then, I installed windows sdk and re-installed node.js but that didn’t help either. It seems to a problem with the npm setup on my machine.
On the other hand, why do you think I can’t get git shell to execute the command?

Thanks for you help so far,.

Hi @rahilj,

Are you using the Node.JS Command Prompt? Or the normal Windows Command Prompt? You might also need to run it as an Administrator.

edit: sorry if I am repeating earlier suggestions! :slight_smile:

Thanks!
David

1 Like

Hi @Dave
I am running through node.js command prompt as an administrator.
Thanks

@rahlij

The error message “failed using git” is kind of odd. git is the command npm uses to download new packages. Keep in mind npm is also a node.js package. (Though now Dave mentions it below I usually just see output for GET requests not git :wink:)

So you can try re-installing git for Windows as well as node.js (I recommend git first). Make sure in the install wizard you check-mark to install all of the components.

Hmm, okay, re-reading this, it sounds like you’re running into problems using Node in a Git shell, and using git in a node shell. :slight_smile:

Hmm… Okay, here’s how you can do a manual install and force NPM to not use GIT:

open up your GIT shell:

git clone https://github.com/spark/spark-server.git
git clone https://github.com/morkai/h5.coap.git

In your NODE shell

cd spark-server
npm install ../h5.coap.git
npm install

Can you give that a try and let me know if that works for you?

Thanks,
David

1 Like

Hi Dave

Yes, you got the problem exactly right. It may be unique to my setup.

I tried your approach with few modifications.;
I used npm install …/h5.coap instead to make it run without ENOENT error. The output looked like:
h5.coap@0.0.0 …\node_modules\h5.coap
└── h5.buffers@0.1.1

Next, npm install executed for a while. It looks it started configuring the project. It created libraries and generated code, however, it failed soon after with the same error:
npm ERR! not found: git

I can send the debug log if that would help. Thanks again for being willing to help and all your support. This is a great community.

Hmm, maybe I messed this up, the protocol module needs the coap module, so…

open up your GIT shell:

git clone https://github.com/spark/spark-server.git
git clone https://github.com/spark/spark-protocol.git
git clone https://github.com/morkai/h5.coap.git

In your NODE shell

cd spark-protocol/js
npm install ../../h5.coap
npm install 
cd ../../spark-server/js
npm install ../../spark-protocol/js
npm install

This should install h5.coap in the protocol module, then install the protocol module into the server, then install the missing packages… hopefully. :slight_smile:

Can you give that a try and let me know if that works for you?

Thanks,
David

Thanks Dave. I will give it a shot later tonight and report back.

1 Like

Guys, can you tell me estimated time of running one request from local cloud?
How long will go command from browser get request to cloud server to core?

It’s really fast but I don’t have the exactly timings.

To put things in perspective, flashing firmware via the spark :cloud: takes around 1 to 1.5 minutes.

Flashing the same firmware on a local :cloud;: requires like 10 seconds.

Thanks for answer, but i’m worrying not about firmware flashing…
I’m just trying to decide, is it better than my own node.js server for spark websockets communication…

1 Like