Friday, April 8, 2016

Running JSBin Local

I'm a big fan of JSFiddle, but unfortunately, being a SaaS solution, I can't run it local on my laptop for those situations where internet isn't an option.     I started looking at some alternatives, such as the older jsbin.    jsbin is both open source and SaaS.  However it does have one big issue, it doesn't install well on ANY operating system with the latest version of Node.jsand npm.

I spent hours trying to get everything running, first I tried Windows after making sure I had all the development dependencies in place, Visual Studio, the correct version of .Net Framework, the sdk's and so forth and then the latest version of NodeJS and npm.  Then following that which what should be the easiest install (In administrator mode)   npm install -g jsbin.

ERR!

First, there are a couple (maybe more) issues with Node.js, and npm on Windows.

First is the rather onerous task of getting all the Windows development pre-reqs in place just so the  node-gyp add-on build tool is in a somewhat workable state.

Second is the default usage of using the users AppData/Roaming folder for npm modules.  This particular folder has policies applied that npm just doesn't like, such as CryptoLock prevention (at least on my system).  Which is a good thing, given some of the security issues with NodeJS currently, but it's a mish-mash of configuration settings trying to set up NodeJS/npm to use something other than that folder, setting the prefix and so forth.

After going down that rabbit hole, I opted instead to fire up a vmware of the debian sort; Mint KDE.  Which has most of the development dependencies already there.  MySQL and MySQL Workbench installed without any issues with openssh-server, and easy installation of the others through apt-get along with the added benefit of being sandboxed and snapshots.

Again,  sudo apt-get install nodejs, sudo apt-get install npm, sudo npm install jsbin

ERR!

The solution,  uninstall nodejs (or in my case revert snapshot), sudo  apt-get install nodejs-legacy (which uses a symlink) , sudo apt-get install -g npm, and then sudo npm -g install jsbin.

and then the crossed finger moment: jsbin....

Success.  

The next step is to try and make mods to the jsbincode. The github jsbin repo  doesn't build currently so more troubleshooting.  I still need to update the resource strings to point to the local versions, with expansion of some newer js and css libraries, which I'll place on the VM Nginx.   o

I know the folks over at jsbin don't have a lot of incentive to update their open source project and instructions to the latest Node.js and npm since they have a paid model, but I sure wish they would.


No comments:

Post a Comment