Vibrant-Colors/node-vibrant

Cannot find module 'node-vibrant/lib/bundle-worker'

theseyan opened this issue · 2 comments

I installed the latest version but had to revert to v3.1.6, due to issue #113 .
I bundle my source files using webpack, and now webpack isn't compiling and throwing this error:

Module not found: Error: Can't resolve 'node-vibrant/lib/bundle-worker' in 'C:\app\services'
resolve 'node-vibrant/lib/bundle-worker' in 'C:\app\services'
  Parsed request is a module
  using description file: C:\package.json (relative path: ./app/services)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      C:\app\services\node_modules doesn't exist or is not a directory
      C:\app\node_modules doesn't exist or is not a directory
      looking for modules in C:\node_modules
        existing directory C:\node_modules\node-vibrant
          using description file: C:\node_modules\node-vibrant\package.json (relative path: .)
            using description file: C:\node_modules\node-vibrant\package.json (relative path: ./lib/bundle-worker)
              no extension
                Field 'browser' doesn't contain a valid alias configuration
                C:\node_modules\node-vibrant\lib\bundle-worker doesn't exist
              .js
                Field 'browser' doesn't contain a valid alias configuration
                C:\node_modules\node-vibrant\lib\bundle-worker.js doesn't exist
              .json
                Field 'browser' doesn't contain a valid alias configuration
                C:\node_modules\node-vibrant\lib\bundle-worker.json doesn't exist
              .wasm
                Field 'browser' doesn't contain a valid alias configuration
                C:\node_modules\node-vibrant\lib\bundle-worker.wasm doesn't exist
              as directory
                C:\node_modules\node-vibrant\lib\bundle-worker doesn't exist
      C:\node_modules doesn't exist or is not a directory

And this is the error on the browser console:
Uncaught Error: Cannot find module 'node-vibrant/lib/bundle-worker'

I am using the web worker bundle:

import * as Vibrant from 'node-vibrant/lib/bundle-worker';

export var ColorGradientService = {

    getPalette: (src) => {
        var v = Vibrant.from(src).useQuantizer(Vibrant.Quantizer.WebWorker).getPalette((err, palette) => {
            console.log(palette);
        });
    }

};

I had the exact same problem. Rolling back to 3.1.3 didn't help at first but after i closed the server and did npm start again it worked.

This is the same issue as this: #85, which I'm working on fixing right now

Temporary solution is to downgrade to 3.1.6. The alpha release was never intended on being made stable and was an accident