I need to use a phantom with the meteor. If I use a separate script, everything works. If I’m using in with the meteor, I get an error.
import React, { Component } from 'react';
var phantom = require('phantom');
phantom.create().then(function(ph) {
ph.createPage().then(function(page) {
page.open('https://stackoverflow.com/').then(function(status) {
console.log(status);
page.property('content').then(function(content) {
console.log(content);
page.close();
ph.exit();
});
});
});
});
export default class App extends Component {
render() {
return (
<div className="container"></div>
);
}
}
C:\OpenServer\domains\EM-topface-like\node_modules\phantom\lib\phantom.js:53 function createLogger({ logLevel = defaultLogLevel } = {}) { SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions…js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object. (C:\OpenServer\domains\EM-topface-like\node_modules\phantom\lib\index.js:7:16) at Module._compile (module.js:409:26) at Object.Module._extensions…js (module.js:416:10) Exited with code: 1 Your application is crashing. Waiting for file change.
How to fix?