Closed Manali-J closed 9 years ago
First, thank for the first feedback on PhantomJS plugin.
I have tried using Phantom 1.9.2 on Windows 7, Nodeclipse:0.17.0.201409260953 Eclipse:4.4.0.v20140606-1215 Java:1.8.0_05 OS:win32,x86_64
And it worked well when launching from Project Explorer or from Editor
What is your path to phantom.exe ? Does it have spaces or other suspicious characters?
Mine is "D:\Progs\phantomjs-1.9.2-windows\phantomjs.exe"
P.S. I even tried "D:\Progs\phantomjs-1.9.2-windows - 副本\phantomjs.exe" and it worked. No idea for now, why it may fails.
Can you get https://github.com/Nodeclipse/nodeclipse-1/tree/master/org.nodeclipse.phantomjs project and run/debug it?
The path for me is D:\phantomjs.exe. Is there any important point I am missing? My phantomjs version 1.9.2.
Well, "D:\phantomjs.exe" is not nice (root of drive D:), but it should work (like any)
I have looked at source org.nodeclipse.phantomjs.launch.LaunchConfigurationDelegate.launch(LaunchConfigurationDelegate.java:81)
it is
String filePath = ResourcesPlugin.getWorkspace().getRoot().findMember(file).getLocation().toOSString();
What is special about your js file?
Try debug https://github.com/Nodeclipse/nodeclipse-1/tree/master/org.nodeclipse.phantomjs
Actually I've tried two paths - "D:\MANALI\phantomjs-1.9.2-windows\phantomjs-1.9.2-windows\phantomjs.exe" and "D:\phantomjs.exe". Issue happens after I create a folder in the project and then try to run the js file.
The js file had this script which works fine when I don't create a folder -
var page = require('webpage').create();
page.open('http://example.com', function(status) {
console.log("Status: " + status);
if(status === "success") {
page.render('example.png');
}
phantom.exit();
});
Should I consider doing a fresh install of Eclipse & Nodeclipse?
The Phantom path is path to Phantom executable, so it should have .exe in the end.
Fresh install of Eclipse & Nodeclipse would make no difference.
Try debug yourself https://github.com/Nodeclipse/nodeclipse-1/tree/master/org.nodeclipse.phantomjs
or guess what is wrong with String filePath = ResourcesPlugin.getWorkspace().getRoot().findMember(file).getLocation().toOSString();
line. I ran out of ideas.
What is .js file path? What is Project path?
.js path - "D:\MANALI\WORKSPACE\PhantomJSTest\test\Test1.js" Project path - D:\MANALI\WORKSPACE\PhantomJSTest
Tried again with Eclipse 4.4.2 all works fine.
I have followed all the instructions from this link.
This is what is causing the issue (below screenshot). I have tried copying the node_modules to the project but that did not help and I'm not sure which environment variable has to be set. I'm still looking.
Well, from "Eclipse Installation Detail" it seems that you have not installed Nodeclipse Nodejs Feature Set. I have never yet had Eclipse with PhantomJS, but without Nodejs...
Also you have also a lot of stuff like C++, Python... Maybe it may cause. So yes please try one more clean Eclipse instance or Enide Studio.
I don't know what the problem was with installing the Nodeclipse plugin. So, I downloaded the Enide Studio and I am not facing any issues with folder structures now.
For a PhantomJS Project, I needed only the following two things:
Thank you for being so patient.
Nodeclipse plugin version: Nodeclipse PhantomJS 0.17 (see screenshot nodeclipse 0.17) Eclipse Version: Luna Service Release 1 (4.4.1) Stackoverflow question: http://stackoverflow.com/questions/29457542/phantomjs-project-in-eclipse-with-nodeclipse-nullpointerexception-when-trying
Reproducible: Yes - consistently
Description: After creating a PhantomJS Project, if we create a javascript file and place it in any folder created under the project and try to run the .js file, a NullPointerException is being thrown in Eclipse. Note that if we don't create any folder structure under the project and try to run the .js files, the scripts run fine. Basically, any attempt to run a script placed inside a folder gives an error. (see screenshot "Folder structure.png").
Steps:
Expected result: Script should run without any errors
Actual result: User is getting a NullPointerException. (see screenshots Error1.png and Error2.png)
Exception details:
An internal error occurred during: "Launching PhantomJSTest-Test1.js". java.lang.NullPointerException
Additional details:
java.lang.NullPointerException at org.nodeclipse.phantomjs.launch.LaunchConfigurationDelegate.launch(LaunchConfigurationDelegate.java:81) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739) at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039) at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)