matthewmueller / x-ray

The next web scraper. See through the <html> noise.
MIT License
5.87k stars 349 forks source link

Can't resolve 'emitter' #303

Closed alexiej closed 6 years ago

alexiej commented 6 years ago

Subject of the issue

ERROR in ./node_modules/x-ray/node_modules/batch/index.js Module not found: Error: Can't resolve 'emitter' in '.\node_modules\x-ray\node_modules\batch' @ ./node_modules/x-ray/node_modules/batch/index.js 8:16-34 @ ./node_modules/x-ray/lib/walk.js @ ./node_modules/x-ray/index.js @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/renderer/components/webpages/Iconlist.vue @ ./src/renderer/components/webpages/Iconlist.vue @ ./src/renderer/router/index.js @ ./src/renderer/main.js @ multi ./.electron-vue/dev-client ./src/renderer/main.js

Your environment

Steps to reproduce

  const Xray = require('x-ray');
      const x = Xray();
      x('https://blog.ycombinator.com/', '.post', [{
        title: 'h1 a',
        link: '.article-title@href',
      }])
        .paginate('.nav-previous a@href')
        .limit(3)
        .then((res) => {
          console.log(res);
        });

Expected behaviour

Working code

Actual behaviour

ERROR in ./node_modules/x-ray/node_modules/batch/index.js

stevenmusumeche commented 5 years ago

what was the issue here @alexiej ?

gokaykucuk commented 4 years ago

same here, but no idea what's the solution

nireak commented 4 years ago

In my case, the problem was with Webpack. It needed the following additional configuration. Hope this helps

const nodeExternals = require('webpack-node-externals')
...
module.exports = {
...
  externals: [nodeExternals()],
...
}
krysalead commented 3 years ago

Hi,

I have the same issue and I am not using Webpack but Serveless bundles. Is there another way to fix it, like downgrading the version of x-ray?

regards