I can't get Spark CLI to work on my Windows 8 Machine

I am somewhat of a novice, so forgive me if I have done something stupid. I have a Windows 8 machine, I installed nodejs, and at the command prompt in Administrator mode I executed “npm install -g spark-cli”.
This is what happened:

C:\WINDOWS\system32>npm install -g spark-cli

serialport@1.4.5 install C:\Users\User\AppData\Roaming\npm\node_modules\spark-
cli\node_modules\serialport
node-pre-gyp install --fallback-to-build

So then I try the “spark cloud login”

C:\WINDOWS\system32>spark cloud login
’spark’ is not recognized as an internal or external command,
operable program or batch file.

C:\WINDOWS\system32>

It seems that the system doesn’t recognise “spark”…

I am pretty excited about this gizmo, but am being a bit frustrated.

Many thanks for any help,

Roger Blott

There’s a tutorial here which will guide you through on what needs to be installed :slight_smile:

1 Like

Make sure you’re using the Node.js command prompt in the Node.js folder in the start menu. Node.js apparently doesn’t permanently modify your system path to be able to run packages from the normal command prompt, but when you run the Node.js command prompt, you should be able to run npm packages.

1 Like

I guess that only holds for installing, since I’m able to use the CLI from my regular command prompt?

Following Kenneths tutorial should work though, it certainly did for me!

I guess it does permanently modify your path then. I think you must have to run that once to get the path set up, though. I seem to remember having this problem the first time I tried to run it with the normal command prompt and I’ve just been using the Node.js command prompt ever since.

Thanks to all of you for your advice. I have moved node.js to the start menu, and checked the PATH which does include a path name for nmp. To be honest, I am not sure what node.js is - am I supposed to be running the spark cli from this, i.e. opening nodejs and then typing “spark cloud login”? I tried that and I just get a “…” prompt (for everything I then type!). So, I suspect that is NOT the thing to do!

Assuming that the Windows cmd.exe is where I should execute “spark cloud login”, I am still stuck. Can I modify the PATH so that the reference to “spark” is valid…and to what??

Thanks, guys, I know I am a bit of a dummy when it comes to all this stuff.

BR
Roger

You should see Node.js and Node.js command prompt both in the start menu. You can try running the one that says Node.js command prompt, but since npm is already in your path, that may not help.

It should have installed the files in C:\Users\<username>\AppData\Roaming\npm, so you can open that folder and see if you see spark.cmd. You’ll have to click on the View tab and check Hidden Items in Explorer first (AppData is a hidden folder). If spark.cmd is there, you should be able to run %appdata%\npm\spark cloud login from a cmd.exe window. If the files are not there, then it didn’t install properly. You may want to try installing it again without running cmd.exe as administrator.

I really appreciate your help/patience. Thanks.

This is what I have in the c:\Users\User\AppData\Roaming\npm file (after un-hiding everything):
. That’s after re-executing “npm install -g spark-cli” as non-administrator (it wasn’t there when I did it as Adminstrator, either).

Now, in the node-modules folder there is a spark-cli folder, but no spark.cmd there, only a spark.js file.
Interestingly, when I click on this the message comes up that it will not run on my computer…it is a 64 bit machine running Windows 8 and I have had this problem before.

Here is the spark.cmd file you’re missing: https://drive.google.com/file/d/0BzhjxZr62WaoYWF5NTBjaF9XZTQ/edit?usp=sharing
Save that in AppData/Roaming/npm and hopefully that will fix it.

Nearly!

I get an error message that relates to the problem at the very beginning of my initial query: the install failure of the serial port module. See below:

It doesn’t seem to recognise ‘cloud’ either which may be related. I read the post “Troubles installing node-serialport during the spark-cli install on Windows” and installed Visual Studio 2013, and I removed Python altogether because I don’t use it… Still no luck.

Hi @rblott,

So close! It looks like the latest node-serialport module isn’t happy on your system. I think there’s a discussion about that here? – https://github.com/voodootikigod/node-serialport/issues/365

edit: that might not be the exact right issue page, but it does look like a serialport issue.

Thanks,
David

The message after the command line is saying that it cannot find a file in a folder v1.4.5 (the rest of the path doesn’t much exist after npm either). I have looked throughout the folders in npm to do with serialport and I can only find references to v1.4.3 buried in a path under folders such as ‘webgeek’ and ‘node-v11-darwin-x64’. I just don’t seem to have the right files… I really am at loss as to what to do and, frankly, why it’s necessary to have a PhD in Windows to install this: all I wanted to do was play with the Spark Core remotely! Here’s a screen shot of the latest…

Not sure if you followed the tutorial i shared during my previous post. I just did an update to the latest spark-cli using serialport v1.4.5 without any issues.

1.) I am on Windows 7 64bit running on Parallels. Windows 8 32 bit OR 64 bit should work the same.

2.) In the tutorial, i mentioned to use only 32bit packages or it might cause some issues.

3.) Same goes to OpenSSL version and 32bit compatability.

You might want to consider going through the tutorial again :wink:

Hi Kenneth,
Thanks - I went through the tutorial again (I removed everything and started again). All in 32 bit. You can see below the result when I called up node.js command prompt and ran the install - prob with the serialport load, again. Also, you’ll see that it doesn’t recognise ‘spark’ when I enter the next command.
Any ideas gratefully received! Thanks, again.
Roger

try npm install -g spark-cli --verbose

Still get this:

:frowning:

There were no error messages?

It’s so weird…

Maybe we can be explicit and install this:

http://www.microsoft.com/visualstudio/eng/2013-downloads#d-2013-express

I downloaded Express 2013 for Windows. I got rid of Python. Tried again:

I am afraid I don’t understand all this stuff, or I might be able to suggest something, but I frankly haven’t a clue what all these things do or what’s actually going on…

Can you run npm install -g serialport --verbose?

I see that your program somehow ended abruptly without completing the installation.

Hi Kenneth,
What you see is the end of the the command: npm install -g serialport --verbose. I looked through it and didn’t see any errors, but I cannot see the whole output because it exceeds the screen buffer. It’s pretty much all Greek to me.
Roger