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

[🐞] Running unit tests encountering error after upgrading to 1.2.0 #4643

Closed
ahnpnl opened this issue Jun 29, 2023 · 9 comments
Closed

[🐞] Running unit tests encountering error after upgrading to 1.2.0 #4643

ahnpnl opened this issue Jun 29, 2023 · 9 comments
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working

Comments

@ahnpnl
Copy link
Contributor

ahnpnl commented Jun 29, 2023

Which component is affected?

Qwik Runtime

Describe the bug

After upgrading to 1.2.0, my company's project pipeline failed with this error

image

I can't reproduce with my Mac M1 locally.

I think it has something to do with sharp and the Gitlab runner OS. The Gitlab runner is a Docker runner.

My company's project uses yarn Berry as package manager which I added the same setup in the example repo.

Reproduction

https://github.com/ahnpnl/my-qwik-app/tree/bug/sharp-error-unit-test

Steps to reproduce

  • Check out the repo, branch bug/sharp-error-unit-test
  • Install deps with yarn
  • Run yarn test.unit

System Info

System:
    OS: Linux 5.4 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (8) x64 Intel(R) Xeon(R) Gold 6346 CPU @ 3.10GHz
    Memory: 6.74 GB / 9.73 GB
    Container: Yes
    Shell: 5.1.0 - /bin/bash
  Binaries:
    Node: 18.16.0 - /usr/bin/node
    Yarn: 3.5.0 - /usr/bin/yarn
    npm: 9.5.1 - /usr/bin/npm
  Browsers:
    Firefox: 102.10.0esr

Additional Information

No response

@ahnpnl ahnpnl added TYPE: bug Something isn't working STATUS-1: needs triage New issue which needs to be triaged labels Jun 29, 2023
@manucorporat
Copy link
Contributor

Is it netlify?

@manucorporat
Copy link
Contributor

Can you double check that the install and execution of the build is done with the same package manager?
ie, not installing with pnpm, then running with yarn, or npm

@ahnpnl
Copy link
Contributor Author

ahnpnl commented Jun 29, 2023

Yes the same package manager was used cross jobs in my CI. The problem didn’t exist with 1.1.5. We don’t use netlify in our codebase.

The error came from the job of running all unit tests for both Vue and Qwik projects via a yarn workspace. When the tests in Vue project were finished, the tests in Qwik started and the error occurred immediately.

@manucorporat
Copy link
Contributor

Trying to rule out some issues, would it be possible to clean up the CI cache?

@krishna-santosh
Copy link
Contributor

krishna-santosh commented Jun 30, 2023

Facing the same issue on my Arch machine when using bun to start dev server, works fine with npm & pnpm

Installed dependencies using bun install

❯ bun run dev          
$ vite --mode ssr
error when starting dev server:
Error: 
Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp-linux-x64.node'
Require stack:
- /home/krishna/Code/Go/todoapp/ui/node_modules/sharp/lib/sharp.js
- /home/krishna/Code/Go/todoapp/ui/node_modules/sharp/lib/constructor.js
- /home/krishna/Code/Go/todoapp/ui/node_modules/sharp/lib/index.js

Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current linux-x64 runtime: "npm install --platform=linux --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
    at Object.<anonymous> (/home/krishna/Code/Go/todoapp/ui/node_modules/sharp/lib/sharp.js:37:9)
    at Module._compile (node:internal/modules/cjs/loader:1255:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
    at Module.load (node:internal/modules/cjs/loader:1113:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1137:19)
    at require (node:internal/modules/helpers:121:18)
    at Object.<anonymous> (/home/krishna/Code/Go/todoapp/ui/node_modules/sharp/lib/constructor.js:11:1)
    at Module._compile (node:internal/modules/cjs/loader:1255:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
error: script "dev" exited with code 1 (SIGHUP)

@manucorporat
Copy link
Contributor

Still trying to figure out why... but seems like a known issue:
lovell/sharp#3511

This is too bad :( i really want developers to use bun, or any other tool, this is because of a new dependency for the image optimization. Sharp is the best, well-known dependency to handle this...

Kind of disappointed with this issues, going to try to hack some solution

@ciprian-macovei
Copy link

the solution i found was
npm rebuild --verbose sharp,
i use qwik in an apline container so I thought that was the problem, this fixed my issue.

@ahnpnl
Copy link
Contributor Author

ahnpnl commented Jul 6, 2023

The tests passed now after rebuilding sharp, but storybook build failed

Could not resolve "./s_hyo3wwc8pcy.js" from "src/entry_Wrapper.js"
...
code: 'UNRESOLVED_IMPORT',
ERR!   exporter: './s_hyo3wwc8pcy.js',
...

I created a separate issue for Storybook build failed #4756

@gioboa
Copy link
Member

gioboa commented Jun 15, 2024

I close this one because it's solved. Thanks

@gioboa gioboa closed this as completed Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants