Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Error: Unable to load plugin "sqip-plugin-primitive". Try installing it via: npm install sqip-plugin-primitive #221

Closed
rrutsche opened this issue Mar 18, 2022 · 4 comments

Comments

@rrutsche
Copy link

Hi there,
first of all - thanks for this package. We are using it with joy since 2 years.
However, unfortunately it's not working on our Mac M1 machines. As the sharp dependency had to be upgraded we also upgraded sqip and the plugins to the current alpha version.
But when calling the package with the following config, we get the error

error Error: Unable to load plugin "sqip-plugin-primitive". Try installing it via:
 npm install sqip-plugin-primitive

The way we call it:

const squipResult = await sqip({
    input: fileName,
    plugins: [
        {
            name: 'sqip-plugin-primitive',
            options: { numberOfPrimitives: 32, mode: 1 }
         },
         'sqip-plugin-svgo'
     ])
  }).catch(error => {
    console.log("error", error);
  });

These are the installed sqip related packages:

    "sharp": "0.30.2",
    "sqip": "1.0.0-alpha.36",
    "sqip-plugin-blur": "1.0.0-alpha.37",
    "sqip-plugin-data-uri": "1.0.0-alpha.37",
    "sqip-plugin-pixels": "1.0.0-alpha.36",
    "sqip-plugin-primitive": "1.0.0-alpha.38",
    "sqip-plugin-svgo": "1.0.0-alpha.38",

Did anyone else have this issue after upgrading? Are we missing something?
Thanks in advance, richard

@axe312ger
Copy link
Owner

axe312ger commented Mar 24, 2022

first of all - thanks for this package. We are using it with joy since 2 years.

Awesome to hear, you are welcome!

-->

Did you install die canary versions? I think so, otherwise you won't have the alphas :/

Can you check if the node_modules/sqip-plugin-primitive/package.json exists and the "main" entry points to a valid file?

@axe312ger
Copy link
Owner

@rrutsche I updated a few dependencies and rereleased. This release works fine for me on my M1.

@rrutsche
Copy link
Author

@axe312ger Thanks for the reply and your quick release. Unfortunately it did not help.

To answer your first question: Yes there is a node_modules/sqip-plugin-primitive/package.json with a valid main entry point. But I think I found the issue. It's due to node version v12.22.3 we are using. Package 'fs/promises' is not available in this version and the plugin fails to load.

I found some comments about it, pretty weird: 'fs/promises' was being introduced in Node 10 but then removed in later patches for Node 10 and Node 12. Works fine in Node 14. Node.js documentation was incorrectly listing this as supported in Node 12 (nodejs/node#35740).

So I guess we have to tell our hoster, that we need a node version bump.

@rrutsche
Copy link
Author

I'll close this issue as I can solve it without the need of a new release or something.
Maybe you could add the engine property to the package json in a future release which specifies the required node version.

Thanks for your help.

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

No branches or pull requests

2 participants