getting error: Could not start Ghost Driver - javascript

I'm trying to run Ghostdriver inside my Openshift server. As i run this command:
./phantomjs --webdriver=15002
It says:
PhantomJS is launching GhostDriver...
[ERROR - 2014-08-01T04:14:21.160Z] GhostDriver - main.fail - {"message":"Could not start Ghost Driver","line":82,"sourceId":139887801789952,"sourceURL":":/ghostdriver/main.js","stack":"Error: Could not start Ghost Driver\n at :/ghostdriver/main.js:82","stackArray":[{"sourceURL":":/ghostdriver/main.js","line":82}]}
$ ./phantomjs --version
1.9.8
Please help me out, I'm getting this error from 10 Days. I searched everything and googled everything. nothing is sorted me out :( I'm much upset :(
Help surely would be appreciated!!

OpenShift doesn't allow binding the localhost address; there is a patch to allow GhostDriver to bind any specified IP (currently it always binds to localhost no matter what), but it still hasn't made it in the PhantomJS source tree and binary distributions.
In order to use PhantomJS + GhostDriver on OpenShift I recompiled it after applying the patch, you can find it here: https://paolobernardi.wordpress.com/2015/02/25/phantomjs-with-ghostdriver-on-openshift/

Check the Port Number while running the below command. Might be your port say 5555 is already in used. So change that if you get this "Could not start Ghost Driver" error
phantomjs --webdriver=5555

From the documentation it looks like you should be able to do something like this:
./phantomjs --webdriver=$OPENSHIFT_NODEJS_IP:15002
You may have to actually type in your ip address there, not sure if that env variable will populate correctly..
http://phantomjs.org/api/command-line.html
--webdriver starts in 'Remote WebDriver mode' (embedded GhostDriver): '[[:]]' (default '127.0.0.1:8910')

I have not been able to make Paolo Bernardi's patch work, I always catched a segmentation fault. So I re-compiled it on an RHEL machine, and this one worked for me: http://christophe-maillard.com/phantomjs-1.9.8.patched/phantomjs.tar.gz
PS: see Trying to run PhantomJS on OpenShift: cannot patch GhostDriver so that it can bind on the server IP address

Make sure the phantomjs process isn't already running
ps -ef | grep phantom

Related

How to stop a NodeJs file on Ubuntu server

I paid someone to install a Js script on my server
but when i tried making some changes on scripts/files i just couldnt see the changes on browser
while browsing and googling for like 24 hours i figured out that js scripts should be restarted in order to show the result on browser
and i figured out that in order to start a node js file i should type in terminal
node /dir/example.js
but can someone help me how to refresh/restart it
Iam stuck here like 24 hours
please help
I just want to let you know too that iam using Putty software in order to connect to the ubuntu server, ubuntu version is 20.04
EDIT: you will need an ssh connection to your server with access to a terminal..
Your node.js scripts, if they are on a server, should typically be ran using a process manager such as pm2.
Try to type pm2 list in a terminal. If you see some information you have hit the spot. Just after that run pm2 restart id. id being the number of your process and your changes should be visible.
You can just try this or try your luck with other process managers that run on your server providers. Just read what your server provider recommends for default and usually your previous developer would have used it.

Windows Script Host Error 800A03EA on Express.js code

I am learning JavaScript development and the book I'm following (JavaScript Everywhere) tells me run this code:
const express = require('express');
const app = express();
app.get('/', (req, res) => res.send('Hello World'));
app.listen(4000, () => console.log('Listening on port 4000!'));
I understand what this code is supposed to do but when I try to run it using src/index.js in the terminal, it always gives me this error:
Syntax Error 800A03EA Microsoft JScript compilation error
I have tried all fixes I found on the internet but I'm guessing this has something to do with the fact that this isn't regular JS syntax, it's Express JS and somehow Express JS is not enabled? I've checked the basics including:
node --version (returns v12.14.0)
npm --version (returns 6.13.4)
npm install express --save just in case there was some problem with ExpressJS API
Windows 10 Laptop, using VSCode. Please ask for any information you need.
Run it using node src/index.js.
By using just src/index.js you are using the default handler for JS files on Windows which is Windows Script Host (and not Node.js).
The solution apply for those who are facing Windows script Error code like 800A03EA. For those, who are unable to open js file and facing error like Windows Script Host.
I was stuck with the same problem for couple of days while working on react.
We have three methods of solving this problem:
Method 1:
Check your computer for viruses and remove them using various method like download MSERT.exe from Microsoft.
Method 2:
Open command prompt as administrator and type following 2 commands:
regsvr32 jscript.dll and press ENTER.
regsvr32 vbscript.dll and press ENTER.
Method 3:
Type internet option on search bar and select it.
Open advance gtab from it and go to security section.
Make sure all of the below ones are selected:
Use SSL 3.0
Use TLS 1.0
Use TLS 1.1
Use TLS 1.2
Method 4:
The workaround that must work 100% but as you know it might be helpful for all, as it only open file do not confuse read the following lines
So simply left click on file and edit and open it.
It will open in notepad and now from here you can transfer your data or use it.๐Ÿ˜
Thanks me later for this detail answer. Now just rock the world!!!!!
Check if your file name isn't "Node.js", just try to rename it in like "randomname.js"

Can't get node-debug to work

This feels really silly, but I can't get node inspector / node-debug to work.
The instructions say to do npm install then to run node-debug web.js. So I did that. Now I have a lovely browser window open showing me my code with breakpoints... and no idea which url to use to actually access the code.
The inspector is at http://localhost:8080/debug?port=5858 and the terminal says:
> node-debug web.js
debugger listening on port 5858
Node Inspector is now available from http://localhost:8080/debug?port=5858
Debugging `web.js`
...
I've tried hitting up localhost:5000 (which is my express.js port) but that either fails if I don't have a separate node web.js instance running, or it succeeds if I have the other one running but doesn't trip any of the breakpoints in the inspector.
When I go to http://localhost:5858/, I get:
Remote debugging session already active
When I go to http://localhost:8080/, I get:
Cannot GET /
(the / path totally works on my server in general.)
By default node-debug starts app in --debug-brk mode.
This stops your app at first line (express not started).
You can use node-debug --no-debug-brk see the node-debug --h for more info.
Agh. Okay, looked at some more questions before I got this posted. Looks like the problem was just that I wasn't running the original instance in debug mode. Nobody had told me I had to, so I just didn't know otherwise!
What's working for me now:
> node debug web
then in a different terminal
> node-debug web.js

Javascript not loading due to net::ERR_CONTENT_LENGTH_MISMATCH

I've got an app that runs fine locally, but barfs in production. (Classic problem, right?)
In production, the JS isn't firing correctly. When I open up the browser console, I see this error:
net::ERR_CONTENT_LENGTH_MISMATCH
When I look in the network tab of Developer Tools, is shows that it failed on a GET request for text/html.
It's a cryptic error. I've only found two other SO posts that even mention is and they're unsolved. (For the interested: first post and second post)
Any idea (1) what it means or (2) how to resolve it?
I am getting Error: net::ERR_CONTENT_LENGTH_MISMATCH
Have a look at your server logs to determine what the real issue is.
For me the problem lay somewhere between nginx and file permissions:
tail -f /usr/local/var/log/nginx/error.log or run nginx -t to determine your conf location, where you could specify a custom log path.
refresh the asset in your browser, eg http://localhost:3000/assets/jquery/jquery.js
You may see something like this in the logs:
"/usr/local/var/run/nginx/proxy_temp/9/04/0000000049" failed (13:
Permission denied) while reading upstream for file xyz
Heres how I fixed:
sudo nginx -s stop
sudo rm -rf /usr/local/var/run/nginx/*
sudo nginx
According to this bug report, that error occurs when an external resource length does not match the Content-Length header given in the response.
This might occur because of a misconfigured server, or (as a stretch) maybe some BOM characters got put into the file, or maybe even different lines endings (are you writing on a DOS machine and deploying to a UNIX machine?) may cause issues.
Hope this helps.
I had a similar issue when trying to interpret JSON results. It turned out that somewhere along the line an odd character landed in the database - in this instance the culprit was "รข??". It is not clear how this value arrived in the database, but it is likely related to HTML encoding issues - "ร‚" character showing up instead of " " Either way, after removing the odd characters, the problem was solved.
I had similar issue
[crit] 6889#0: *14817 open() "/var/cache/nginx/proxy_temp/3/02/0000000023" failed (13: Permission denied) while reading upstream
it was because Nginx worker process were not able to access folder /var/cache/nginx/proxy_temp/ - I just changed the folder permissions and everything started working
I had similar issue developing locally on MAMP and using Chrome as browser. Same problematic websites on the live servers had no such issues. First I thought it was MAMP that was playing around and I checked settings like PHP versions mismatch, apache version etc., reinstalled, but the issue remained. At the end I just switched to using Brave browser (was delaying the shift to Brave for a while anyway) and that fixed it for me.
Hope this helps.

Sails.js server not starting anymore

I am using Cloud 9 IDE to develop a simple CRUD application using Sails.js (node.js MVC framework). Up until today I had no trouble starting the Sails.js server.
Today, I've been trying to start the sails js server, but I keep getting this error:
warn: error raised: Error: listen EACCES
error: Server doesn't seem to be starting.
error: Perhaps something else is already running on port 8080?
I have checked my /config/local.js file and everything is just fine, as it should be. The port is set to process.env.PORT || 1337 so it shouldn't have any problems firing the server up.
I'm looking forward to your insight.
Thank you!
Open terminal and run this command:
$ lsof -i :8080
Output will show PID of process occupying port 8080: "httpd 1234 ....'
Then kill the process with this command
$ kill -9 1234
Sails will now run
Hmm-- looks like port 8080 isn't available. What happens if you try to switch the port? You may have another server running on that port. Or in some cases, hosts require the hostname to be set. I'd try switching the port first though.
The only real answer to this is: wait. C9 seems to kill servers in a weird way that causes Sails to jack up and blocks you from establishing another server. lsof -i doesn't show anything serving... but it still won't start. Seems to be an issue with Cloud 9 and Sails.js. If I serve a generic Node.js "Hello World" app on the same port, the issue doesn't occur. However, time, it seems, cures all. After awhile, Sails seems to snap out of it and starts serving again when lifted.
Incredibly weird.

Categories

Resources