Guys I’ve been trying very hard to get polyfill / local development working for all the apps I’m making for the SAFE Browser and just setting this all up has proven to be the most difficult part
I have had help from @happybeing and @joshuef so far, and now I am running my code (using Demo Web App code for this example) from my Apache’s /var/www/html/ folder and opened that localhost in my SAFE Browser. So I can see my demo web app running, but I can’t get any of the commands (auth is the first page that pops up on the demo app) to run
I am not even at the polyfill part yet, just trying to get a simple command running.
So I tried changing the safeAuth.authorize…etc part in my app’s JS to safejs.auth.authorize like this polyfill says. No luck. Tried lots of other thngs too.
Do I have to have a safe-js folder somewhere??
npm doesn’t even let me install safe-js.
Result of running npm i safe-js:
~$ npm i safe-js
npm WARN enoent ENOENT: no such file or directory, open '/home/wook/package.json'
npm WARN wook No description
npm WARN wook No repository field.
npm WARN wook No README data
npm WARN wook No license field.
sorry for all this mayhem…
just someone pleeease help me get polyfill running!!
EDIT #2: I put the compiled polyfill.js file by itself into my apache website folder (var/www/html/) and now I guess the polyfill part is working maybe? but this error is still stopping my local version of my SAFE-FS Demo App from working at all. The page loads up but none of the buttons (authorize, etc) can ever work. Do I need to install safe-js somewhere maybe?
well I guess I’m stuck at the “build from source” part, never ever done anything like that
I cloned from github, so I have all the files, but everything I find on google about building from source is either irrelevant or doesn’t work for this browser
so I just tried typing in “NODE_ENV=debug npm run start” after cd into the beaker-master folder, but got all these errors:
> @ start /home/wook/Desktop/beaker-master
> gulp start
sh: 1: gulp: not found
npm ERR! Linux 4.4.0-47-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "start"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @ start: `gulp start`
npm ERR! spawn ENOENT
npm ERR! Failed at the @ start script 'gulp start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! /home/wook/Desktop/beaker-master/npm-debug.log
wook@wook-ThinkPad-T410:~/Desktop/beaker-master$ sudo apt-get install gulp
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gulp
then tried installing ‘gulp’ but no package exists.
How did you guys install this browser from source?
I followed the instructions on github, but may have already had some things installed. In the early days of my adventures with npm, gulp etc I remember having various problems, so don’t be discouraged.
@bochaco did say that he managed to do this without building from source, even though that is supposed to be required, and because of that I’ve always done so. The CORS issue does suggest to me that building from source will solve the error you found in the screenshot.
Anyway, back to your gulp error… Did you follow these instructions in the reader before trying the above?
Correct, that’s how I’m currently developing, just using the AppImage v0.4.0-5 and then the option “Toggle WebSecurity for new tabs”.
I was also able to build it from source. If you got the gulp error from following the instructions on the breaker’s README.md file, I guess you then need to overcome the issue related to installing gulp.
I installed all that, and it gave a few errors but at least the browser loads up when I run the commands.
Here are the errors:
despite that, I now have my beaker running (although it looks like a generic beaker, and looks different than @joshuef 's build.
I looked for the “BeakerDev” menu and only see this at the top, which only gives two options ("Reload Shell-Window" and “Toggle Shell-Window Devtools”. I’ve tried both and neither let my safe-js commands work.
Is this the right menu? it’s the only similar type of thing I can find to what you described:
sorry for all these questions! This seems to be an important part of building SAFE Web Apps and (like everything I do), once I understand it I will definitely write a tutorial so no other new SAFE App Developers will ever have to go through all this craziness again
Hmm, seems the readme steps there on the repo were still referencing a line about changing branch. I’ve removed this now, so you should just be on the master git branch of https://github.com/joshuef/beaker/.
If you do need to change the branch back to master there, be sure to run npm i again in the root project folder before running npm run start.
You should also need to run export NODE_ENV=development to get the dev menus in beaker.
I’m travelling today but I’ll try and check later to see how you get on @WhiteOutMashups
And @joshuef , having just gone through this I have 2 questions:
can the polyfill.js file be somehow embedded into the Browser so new app devs won’t have to grab a compiled copy and place it into their localhost app files?
is there a way we can get this dev option of “Toggle WebSecurity for New Tabs” into the production release builds? I can definitely see that this may lower security, so NO is a totally acceptable answer, but I was thinking maybe it could be put deep in the “Advanced Options” somewhere or something, so people would only need one build of the browser, and would remove many of the steps I just did.
Either of these would make it easier for new people to make SAFE Web Apps in the future