question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[LibSquoosh] URL invalid

See original GitHub issue

Describe the bug Use the github action to compress images. It’s says can’tt find the wasm files. But there is in repo.

git clone 'https://github.com/SettingDust/image-compress-action' # ref=main
docker cp src=/home/runner/.cache/act/SettingDust-image-compress-action@main dst=/actions/
TypeError [ERR_INVALID_URL]: Invalid URL: /actions/SettingDust-image-compress-action@main/dist/mozjpeg_node_enc-13aa762d.wasm
    at onParseError (internal/url.js:259:9)
    at new URL (internal/url.js:335:5)
    at Object.7275 (/actions/SettingDust-image-compress-action@main/webpack:/image-compress-action/node_modules/@squoosh/lib/build/index.js:1:1)
    at __nccwpck_require__ (/actions/SettingDust-image-compress-action@main/webpack:/image-compress-action/webpack/bootstrap:21:1)
    at Object.3109 (/actions/SettingDust-image-compress-action@main/webpack:/image-compress-action/lib/main.js:37:1)
    at __nccwpck_require__ (/actions/SettingDust-image-compress-action@main/webpack:/image-compress-action/webpack/bootstrap:21:1)
    at /actions/SettingDust-image-compress-action@main/webpack:/image-compress-action/webpack/startup:4:1
    at Object.<anonymous> (/actions/SettingDust-image-compress-action@main/dist/index.js:12521:12)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
Error: exit with `FAILURE`: 1

Expected behavior Compress

Version:

  • OS w/ version: ubuntu-18.04 in docker. Host is ubuntu-20.04 in docker.
  • Node version: May be 14.17.0. There isn’t detail in action log.
  • npm version: May be 6.14.13.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
Kristinitacommented, Aug 18, 2022

Status: Same problem 😔

1. Environment

  1. Microsoft Windows [Version 10.0.19041.1415]
  2. Node.js v18.7.0
  3. @squoosh/cli@0.7.2
  4. @squoosh/lib@0.4.0

2. Console output

D:\SashaDebugging\KiraSquooshImages>npm i -g @squoosh/cli
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@squoosh/cli@0.7.2',
npm WARN EBADENGINE   required: { node: ' ^12.20.2 || ^14.13.1 || ^16.0.0 ' },
npm WARN EBADENGINE   current: { node: 'v18.7.0', npm: '8.16.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@squoosh/lib@0.4.0',
npm WARN EBADENGINE   required: { node: ' ^12.5.0 || ^14.0.0 || ^16.0.0 ' },
npm WARN EBADENGINE   current: { node: 'v18.7.0', npm: '8.16.0' }
npm WARN EBADENGINE }

added 37 packages, and audited 38 packages in 9s

11 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
D:\SashaDebugging\KiraSquooshImages>squoosh-cli --help
Usage: squoosh-cli [options] <files...>

Options:
  -d, --output-dir <dir>                                 Output directory (default: ".")
  -s, --suffix <suffix>                                  Append suffix to output files (default: "")
  --max-optimizer-rounds <rounds>                        Maximum number of compressions to use for auto optimizations (default: "6")
  --optimizer-butteraugli-target <butteraugli distance>  Target Butteraugli distance for auto optimizer (default: "1.4")
  --resize [config]                                      Resize the image before compressing
  --quant [config]                                       Reduce the number of colors used (aka. paletting)
  --rotate [config]                                      Rotate image
  --mozjpeg [config]                                     Use MozJPEG to generate a .jpg file with the given configuration
  --webp [config]                                        Use WebP to generate a .webp file with the given configuration
  --avif [config]                                        Use AVIF to generate a .avif file with the given configuration
  --jxl [config]                                         Use JPEG-XL to generate a .jxl file with the given configuration
  --wp2 [config]                                         Use WebP2 to generate a .wp2 file with the given configuration
  --oxipng [config]                                      Use OxiPNG to generate a .png file with the given configuration
  -h, --help                                             display help for command
D:\SashaDebugging\KiraSquooshImages>squoosh-cli "KiraTestImage.jpg"
node:internal/deps/undici/undici:6277
          p.reject(Object.assign(new TypeError("fetch failed"), { cause: response.error }));
                                 ^

TypeError: fetch failed
    at Object.processResponse (node:internal/deps/undici/undici:6277:34)
    at node:internal/deps/undici/undici:6602:42
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8) {
  cause: Error: unknown scheme
      at makeNetworkError (node:internal/deps/undici/undici:5251:51)
      at schemeFetch (node:internal/deps/undici/undici:6578:18)
      at node:internal/deps/undici/undici:6434:26
      at mainFetch (node:internal/deps/undici/undici:6451:11)
      at fetching (node:internal/deps/undici/undici:6408:7)
      at Agent.fetch2 (node:internal/deps/undici/undici:6288:20)
      at Object.fetch (node:internal/deps/undici/undici:7076:20)
      at fetch (node:internal/bootstrap/pre_execution:199:25)
      at instantiateAsync (C:\Program Files\nodejs\node_modules\@squoosh\cli\node_modules\@squoosh\lib\build\index.js:28:11469)
      at createWasm (C:\Program Files\nodejs\node_modules\@squoosh\cli\node_modules\@squoosh\lib\build\index.js:28:12079) {
    [cause]: undefined
  }
}

Node.js v18.7.0

I get the same result for different images in different formats.

Thanks.

1reaction
theborakompanionicommented, May 30, 2022

The only thing that has changed for me was node 18 being upgraded to a newer version, so perhaps that’s the root cause.

Forr anyone running into the same problem: Temporarily downgrading to node >=v16 when using @squoosh/lib@0.4.0 is a successful workaround. Thank you 💪

Read more comments on GitHub >

github_iconTop Results From Across the Web

The unofficial way to embed Squoosh into your web app.
Once it was all built, all I had to do was copy the WASM and JS bindings into my repository and call it...
Read more >
Giulio Ganci (@toriphes) / Twitter
Introducing: libSquoosh libSquoosh is an experimental Node library on top of which the Squoosh CLI is built, giving you all the capabilities for...
Read more >
Introducing libSquoosh - web.dev
We are happy to introduce libSquoosh, an experimental Node library on top of which the Squoosh CLI is built, giving you all the...
Read more >
#458 - Upgrade libSquoosh for TypeScript types - www-new - CSC Git
www-new - Computer Science Club of the University of Waterloo's website.
Read more >
Picasso Library Load Error - Stack Overflow
picasso don't load gif image for that you have to use Glide library. Check this link it might help you ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found