I want to get started with firebase on a Windows machine but I don't understand the getting started instructions on https://www.firebase.com/docs/web/quickstart.html.
I created a .html file with the following content (copied from the instruction on that page). That works, info is added to the database and retrieved from the database. However I'm lost on Linux like instructions like $ npm install -g firebase-tools on that page.
I installed nodejs following the link to nodejs.org on https://www.firebase.com/docs/hosting/quickstart.html
If I execute the above command (without the linux $-prompt) in the node.js screen I get the following error message npm should be run outside of the node repl, in your normal shell.
(Press Control-D to exit.)
So then what?
<html>
<head>
<script src="https://cdn.firebase.com/js/client/2.2.1/firebase.js"></script>
</head>
<body>
<script>
var myFirebaseRef = new Firebase("https://torrid-inferno-6000.firebaseio.com/");
myFirebaseRef.set({
title: "Hello!",
author: "Firebase",
location: {
city: "San Francisco",
state: "California",
zip: 94103
}
});
myFirebaseRef.child("location/city").on("value", function(snapshot) {
alert(snapshot.val()); // Alerts "San Francisco"
});
</script>
</body>
</html>
Basically i had to open command prompt and switch to C:\Program Files\nodejs, where file npm is located), then npm commands can be executed according to instructions. Later on when firebase is installed perform a restart for the changes to PATH environment variable to take effect. After that the firebase (init, deploy, ...) command can be used to deploy a site.
Firepit is a new CLI tool built for Windows that attempts to be the native firebase-tools
Firepit is a standalone, portable version of the Firebase CLI which has no depedencies (including Node.js). Download, click, and immediately get access to both firebase and npm commands.
Worth checking out https://github.com/abehaskins/firepit
Related
I am unable to run e2e tests with protractor 7 with the following configuration
...
directConnect: true,
capabilities: {
browserName: 'firefox'
}
...
on my MacOS Catalina. I noticed the
webdriver-manager update
command from the project's package.json downloads the geckodriver-v0.29.1.
As mentioned in the title the logs do not go beyond Using FirefoxDriver directly... when I run the tests. How can I check logs in more details (is there a verbose option in protractor?), and how can I fix the issue ?
With Splaktars answer I was able to get Firefox to launch using the typical directConnect: true setting.
I had to download the geckodriver-v0.29.1-macos.tar.gz package from the Github Releases and extract the binary. Then I replaced the geckodriver-v0.29.1 binary previously downloaded through webdriver-manager with that copy from the package.
After that I launched my tests to make sure everything was still partially working and finally saw the MacOS security popup. I ran the command to remove the quarantine flag:
xattr -r -d com.apple.quarantine /path/to/geckodriver-v0.29.1
Relaunched the tests and finally Firefox popped up...
Thanks again to Splaktar, just made an account so I can't comment or upvote for help
It looks like there is a known issue in the v0.29.1 release notes:
https://github.com/mozilla/geckodriver/releases/tag/v0.29.1
Those point to some GeckoDriver macOS Notarization docs:
https://firefox-source-docs.mozilla.org/testing/geckodriver/Notarization.html
However that page say
Arbitrary software downloaded through other means, such as curl(1) is not affected by this change.
I don't get any security pop ups or warnings, just the hang that you see.
Running
xattr -r -d com.apple.quarantine /Users/splaktar/Git/app/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.29.1
Doesn't help.
In https://github.com/angular/protractor/issues/4253, there are a lot of old issues mentioned with Firefox and directConnect support. I tried using directConnect: false with a suggestion from that issue:
config.capabilities = {
'browserName': 'firefox',
'marionette': true,
'elementScrollBehavior': 1
};
config.directConnect = false;
config.seleniumAddress = 'http://localhost:4444';
config.localSeleniumStandaloneOpts = {
jvmArgs: ['-Dwebdriver.gecko.driver=node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.29.1']
};
I ran webdriver-manager start and then ran my tests, but that failed quickly with an error page's HTML in the console and From: Task: WebDriver.createSession() Process exited with error code 199.
I also tried setting
config.firefoxPath = '/usr/local/bin/firefox-bin';
after creating a symbolic link there to /Applications/Firefox.app/Contents/MacOS/firefox-bin. But that didn't help at all. Firefox never gets started. I tried with Firefox Developer Edition as well.
Still investigating...
I am following this tutorial
https://hyperledger.github.io/composer/integrating/deploying-the-rest-server.html
I have done all the steps. But when I run rest-server through github, it prints following stack trace.
Error
404 Cannot GET /auth/github
status: 404
Error: Cannot GET /auth/github
at raiseUrlNotFoundError (/home/praval/.nvm/versions/node/v6.11.1/lib/node_modules/composer-rest-server/node_modules/loopback/server/middleware/url-not-found.js:21:17)
I presume you installed the Github strategy via npm install -g passport-github?
If so did it create a folder /auth/github?
You are required to go to this Folder per documentation: "Authenticate to the REST server by navigating to the value of the authPath property specified in the environment variable COMPOSER_PROVIDERS. In the example above, this is http://localhost:3000/auth/github"
In my case that folder was not created. I read on Github website: https://github.com/cfsghost/passport-github
"The author of Passport-Github has not maintained the original module for a long time. Features in his module don't work since Github upgraded their API to version 3.0. We forked it and re-published it to NPM with a new name passport-github2"
I'm looking for guidance on this.
Before create private api just execute this command in your terminal.
export COMPOSER_PROVIDERS='{
"github": {
"provider": "github",
"module": "passport-github",
"clientID": "<your id>",
"clientSecret": "<your secret>",
"authPath": "/auth/github",
"callbackURL": "/auth/github/callback",
"successRedirect": "http://localhost(domain of angular app):4200(port)/home(page to redirect)",
"failureRedirect": "http://localhost(domain of angular app):4200(port)/login-github(page to redirect)""
}
}'
To check if all is fine - run command
echo $COMPOSER_PROVIDERS
After this you will see your COMPOSER_PROVIDERS value.
And after in github profile app (https://github.com/settings/applications/) you must configure "Homepage URL" (ex. http://APIdomain:3000/) and "Authorization callback URL" (ex. http://APIdomain:3000/auth/github/callback)
How can I parse the version number of Firefox programatically.
So, I don't have to visit the page every time.
All I would have to do is run the script, and it will give me the latest version.
http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/update/win32/en-US/
The file will always have ".complete.mar" in it. It's the only file with the word "complete" under this directory.
How can I parse the version "40.0.2" from it.
Download the latest release
The simple answer is Mozilla Release Engineering already provides a way to download the latest version. See https://ftp.mozilla.org/pub/firefox/releases/latest/README.txt
For example, I want to download the latest Linux 64-bit US English version of Firefox. So I would:
curl -Lo firefox.tar.bz2 'https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US'
tar -xjf firefox.tar.bz2
cd firefox
./firefox --version
Mind you those are stable releases and not RC or nightly. For those see release notes in the appropriate subfolder.
Notes:
The curl command URL is surrounded by single quotes (') to avoid bash interpreting the ampersands (&).
You would likely want to add your downloaded Firefox at the beginning of the $PATH (or %PATH% in Windows) environment variable.
Get latest release version number
To get the latest version number without downloading the archive you would use the HTTP HEAD method (curl -I option). Example,
curl -fI 'https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US' | grep -o 'firefox-[0-9.]\+[0-9]'
which will return something like firefox-67.0.4.
Because I have to know the lastest version numbers of many applications, I've created the online service called vergrabber which provides that information in json.
You may try this free service at http://vergrabber.kingu.pl/vergrabber.json
You are going to run into problems because the data you want to check is not within the same domain.
You can however using something like node webkit(now nwjs) to get pass the browser limitation.
To start download the nodewebkit files for your operating system from the following link:
http://nwjs.io/
Extract the contents.
Download JQuery and place it in the extracted folder(rename the file jquery.js).
create a new text file, add the following contents and save it as package.json
package.json contents:
{
"main": "index.html",
"name": "firefoxversion",
"version": "1",
"window": {
"title": "latest firefox version",
"icon": "link.png",
"toolbar": true,
"width": 800,
"height":600
}
}
Create a file name index.html and save the following contents:
index.html contents:
<html>
<head>
<title>Latest Firefox Version</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="result"></div>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="main.js"></script>
</body>
</html>
Next create a file named main.js and save the following contents:
main.js contents:
var url ="http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/update/win32/en-US/";
var version;
$.get(url,function(data){//begin function
$(data).contents().find("a").each(function(){//begin each function
//create an array to hold the hmtl
var html = [];
if($(this).attr("href").indexOf("complete.mar" !== -1 )){//begin if then
version = $(this).attr("href").split(".c");
//start building your html to output
html.push("Download the latest Firefox Version " + version[0] + " below:<br>");
//add the download button
html.push("<input type ='button' id ='firefox-latest' value = 'Download Firefox'>");
//display the html in the #result div
$("#result").html(html.join(""));
}//end if then
});//end each function
});//end function
//on click event for #firefox-latest
$(document).on("click","#firefox-latest",function(){//begin on click event
//change the window location to the file for the latest firefox version
window.location.href = url + version[0] + ".complete.mar";
});//end on click event
Lastly click on the nw.exe icon inside of the folder you extracted earlier
and you should see the latest version number of firefox.
I am trying to figure out what is wrong with my sessions (using express-session), and I found that it uses the debug module. However, I can't seem to enable the debug messages. It says, debugging needs to be enabled through the DEBUG environment variable, but I can't seem to get it to run.
The tutorial in the README has this picture:
Under Windows I get "DEBUG is not a command for the command-line".
So I tried setting the environment variable explicitly using:
process.env.DEBUG = "*";
and still nothing.
What am I doing wrong?
As Traveling Tech Guy suggested in the comment, in a Windows command prompt, the proper syntax is:
set DEBUG=* & npm start
Obviously you can replace npm start with whatever command you need to launch your Node.js app. Just be sure to use the set command and don't forget the & between that command and the one launching your Node.js app!
If you are used to powershell, I recommend this setup in your package.json, then you can just run npm start so you don't type all that out every time.
"scripts": {
"start": "#powershell $env:DEBUG='*,-express:router*' ; node app.js"
},
Install debug package with npm inside the node application
npm install debug
Open a powershell and then
$Env:DEBUG="name_to_call"
node path_to_js_to_execute.js
Inside your pgm
var debug = require('debug')('name_to_call');
Firstly you need to install the debug module using
"npm install debug --save"
you will see that the following lane has been added to you package.json (which has all the npm modules charged to your proyect)
then you need to add this to import the module to the file in which you want to run the debug
var debug = require('debug')('name_to_call');
now we have to just put the message we want to write, for example hello
var debug = require('debug')('name_to_call');
debug('Hello');
(try pasting the code above directly to a file)
Now we just need to start the windows server with DEBUG, to do so we are going to use the npm package cross-env that will make easier to set an ENV variable across any operating system (platform agnostic)
npm install cross-env
Change the package.json and add the following under the scripts section
"start-server": "cross-env DEBUG=name_to_call node server.js"
Now to start the server just run the following in a command line (from the directory in which your project is) and you are good to go
npm run start-server
In Babun a windows shell, I run,
npm
npm install debug --save
babun
DEBUG=http node app
app.js
var app = express();
var debug = require('debug')('http');
var http = require('http').Server(app);
var server = http.listen(app.get('port'), function() {
debug('listening on port ' + server.address().port);
});
works like a charme for me.
Windows Command:
set DEBUG=* & node ./app.js
PowerShell:
$env:DEBUG='*'; node app.js
Terminal/WSL (Ubuntu):
DEBUG=* node ./app.js
I've installed Cloud9 IDE on my linux machine in order to play around with it a bit (I had to use nodejs 0.8 because cloud9 uses a package that depends on node-waf, which is no longer supported by higher versions of nodejs).
I can start it up without problems, however when I try to access Cloud9 via browser, it constantly gives me the error message: File already exists.. Here's a trace from the log:
Error: File already exists.
at module.exports.from (/home/xyz/repos/cloud9/node_modules/vfs-local/localfs.js:678:35)
at Object.fs.exists [as oncomplete] (fs.js:91:19)
Relevant code section:
exists(topath, function(exists){
if (options.overwrite || !exists) {
// Rename the file
fs.rename(frompath, topath, function (err) {
if (err) return callback(err);
// Rename metadata
if (options.metadata !== false) {
rename(WSMETAPATH + from, {
to: WSMETAPATH + to,
metadata: false
}, function(err){
callback(null, meta);
});
}
});
}
else {
var err = new Error("File already exists.");
err.code = "EEXIST";
callback(err);
}
When the error occurs, the topath variable is set to the workspace settings file (/home/xyz/repos/cloud9/workspace/.settings)
Has anyone else had an error like this? How can I resolve it?
thx in advance
Reinstalling cloud9
First option, maybe you could try using this workaround installation procedure:
https://github.com/ajaxorg/cloud9/issues/2904#issuecomment-22518669
Second option, if you are willing to always use an older node-version for running cloud9 as you indicated, I used the following installation procedure and it worked (assuming you already installed nvm). Then you can still use the cloud9.sh-file for starting:
git clone git://github.com/ajaxorg/cloud9.git
cd cloud9
nvm install 0.8.8
sed -i -e 's/~//g' package.json
npm config set ca=""
npm install
sed -i s/connect.session.file/connect.session.memory/ configs/default.js
Not sure if 0.8.8 is the best node-version for cloud9 but it works for me :)
Last step seems necessary because of https://github.com/ajaxorg/cloud9/issues/2005#issuecomment-11372587 :)
Then before starting cloud9 you always have to enter:
nvm use 0.8.8
Or you set 0.8.8 as the default node version if you don't use node much otherwise:
nvm alias default 0.8.8
Fix problem without reinstalling
Third option, if you don't want to repeat the installation procedure you could try just reinstalling the vfs-local-module in the cloud9 directory:
npm install vfs-local#0.3.4
Haven't tested this though :)