Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Compatibility issue with Packages based Architecture (with PhantomJS) #126

Open
anothermohit opened this issue Mar 8, 2016 · 1 comment

Comments

@anothermohit
Copy link

Hi,

I am trying to use Phantomjs. It works perfectly fine if I install it directly in my Meteor directory following these steps - http://stackoverflow.com/a/28125219/4382567

But I am not able to get it to work when keeping this code in a separate local package.

Here is what I am doing:
I have set the dependency of my package on meteorhacks:npm (and tried npm-container too) and keeping the packages.json file in the root path of my package.

The error I am getting:
ReferenceError: require is not defined

Could you please tell me how to resolve this?

@anothermohit anothermohit changed the title Compatibility issue with Packages based Architecture Compatibility issue with Packages based Architecture (with PhantomJS) Mar 8, 2016
@anothermohit
Copy link
Author

I have found a workaround myself but sadly it's not wrapping up the complete code in a package. Here is what worked for me, in case anybody else comes here looking

So, I added the package.json and private/phantomDriver.js in my ROOT meteor directory and put my Meteor method inside my local package. So, following this answer , you don't have to change any code, just reposition the files this way.

One weird thing happens when you don't put any js file in your ROOT directory, your assets (package.json and phantomDriver.js) sitting in the root becomes inaccessible. So, you have to create a blank .js file in the ROOT directory to resolve this meteor issue, if you don't have any other (like in the strict package architecture, but sadly it won't remain anymore now).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant