PhantomJS gives Segmentation fault when running any js using command line - javascript

I have installed Phantomjs 1.9.8 on my Centos 6.5 server.
From the command line if I type
phantomjs -v
I get the correct version number returned, so I presume that it is installed ok.
However if I create a simple javascript file, using the most basic example from the phantomjs example:
console.log('Hello, world!');
phantom.exit();
and save this to a file test.js, navigate to that folder via command line and run
phatomjs test.js
I get
PhatomJS has crashed... Segmentation fault.
Any idea what could be causing this or further tests I could run?

A simple solution - A key step of course is that you have to restart your apache web server to get this to work, I had forgotten this.
Leaving this up in case it helps anyone else stumbling along the same route

Related

How to restart a Node.js project?

I'm not a Node.js developer. So I have no idea how it works. I've been a PHP developer for over 8 years.
Because of some reason, I need to make a small change in a Node.js project which is live. All I have to do is changing a payment gateway token. I did it like this:
After pulling it on the server, users still go to the old payment gateway. So I guess I need to do a restart. (I'm saying so because, for PHP projects, when you change a config-related thing, you need to restart PHP).
Not sure should I restart what thing? Noted that, the server is Ubuntu 20.04 and uses Nginx to talk to Node.js. In other word, how can I see Node is running as what service on Linux?
Also, there are two files that I think I need to run the project again after restarting Node through one of them: index.js, server.js. Am I right?
And
Your Node.js script likely runs under a process that restarts the script in case it dies. There are several "run forever" wrappers, the most popular one is pm2. Find out which one is used in your project. Try pm2 list as the user your project executes under. If pm2 type pm2 restart app_name to restart your project.
Please check if it is a node.js project so you can write the command node index.js or node server.js with this command you can start your node server.

How to resolve the build error on react-native?

I'm trying to make a build environment to make an android app but I haven't been able to succeed to build the project. The build log is as follows,
Starting Gradle Daemon...
Gradle Daemon started in 5 s 673 ms
:ReactNative:Running '[node, -e, console.log(require('react-native/cli').bin);]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\WorkSpace\MyProject\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 179
* What went wrong:
A problem occurred evaluating script.
> Cannot run program "node" (in directory "C:\WorkSpace\MyProject\android"): CreateProcess error=2, �w�肳�ꂽ�t�#�C����������܂���B
It looks exactly same as the link below and I did the same thing but I can't resolve the problem and the log that it makes is always the same.
https://forums.expo.io/t/android-cannot-run-program-node-error-2-no-such-file-or-directory/37693
reinstall node. delete node modules and
clean and run the project again.
I can't comment so i answered.
I renew nodejs that I was using and it solved it.
Before:14.6.0
After:14.7.0
I don't know exactly why and node_modules seems to be not changed at all but at least a build succeeded.

Git return "'pull' is not a git command. See 'git --help'" from remote on Windows 10

I have a bonobo server on my server that is running windows 10.
I'm trying to link a new hook on "Update", so the files from the node development server can get updated directly from git.
I tried to do so using a cmd file, examples to follow:
update file in hooks
cmd //C "start C:\webServer\node\testServer\update.bat"
update.bat on the same folder on testServer
set PATH=%PATH%;C:\Program Files\Git\cmd\git.exe
cd C://webServer/node/testServer
git pull
That was returning the following error:
git: 'pull' is not a git command. See 'git --help'
I did some research and found out this post "git pull" broken where they talk about using -exec-path on Mac, I tried to search the equivalent in Windows and found out some variables for path related issues, tried them an none of them worked, also tried to reinstall git without any other result, at that point I was tired of it and I tried to use a node library, simple-git, that allows me to do a pull request using node specifying the path! I tried it on the server, and it worked! (I will attach the code of the file below) so I thought to try it from the remote server, but then I got the same error again, pull is not a git command, I tried to call the node file in different ways, I tried some python script to run a cmd command that runs the node server, I tried using bat and sh files, even using node to run another instance of node, and nothing worked, it always returns pull is not a git command :/
Node simple-git code
require('simple-git')("C:\\webServer\\node\\testServer")
.pull(function(a,b){
console.log(a,b); //for debug
})
Has additional information, git is properly set up as an environmental variable and I can access it without problems from the server, this issue only happens when trying to execute the pull from the hooks!
If anyone can give me some tips on what to try that would be awesome, thanks!

Internal Server error using Bash Terminal, any idea why is it throwing this error and how to fix it?

I have just recently started learning about APIs as party of Full stack developer course. Everything has been working fine until I have activated system storage sense in Windows to clear some space in the disk /c, the curl command stopped working and is giving internal server error.
curl calling request error using bash terminal
I have realized there is an issue when I have run my code and it stopped pulling information from the API link.
Since you made a windows change my guess would be - try addding the curl folder path to your Windows PATH environment variable so that the curl command is available from any location at the command prompt.

PhantomJS not working with Jenkins

I followed Web page Capture and save to image using phantomjs lib and able to save screenshot on my local.
However when executing PhantomJS command with Jenkins, following error is generated: "_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL." and screen shot is not saved on Jenkins.
Can anyone please guide me?
I've found two possible solutions to this problem:
As user2325313 commented, if you login as the Jenkins' user you should be able to avoid this issue.
Run Jenkins as a standalone application instead of a daemon. To do so, locate your Jenkins .war file and execute it from the terminal using the following command :
java -jar /Applications/Jenkins/jenkins.war

Categories