QwikCommunity / pwa

Turn your Qwik Application into an offline compatible PWA
https://pwa-a3b.pages.dev/
90 stars 8 forks source link

Cloudflare build fail #11

Closed dejurin closed 8 months ago

dejurin commented 8 months ago

Hello, there I got problem again.

I copy your example and change it only:

- "@qwikdev/pwa": "workspace:../",
+ "@qwikdev/pwa": "^0.0.4",

Repo: https://github.com/dejurin/pwa-example/blob/main/package.json

I tried pnpm and npm ... I tried remove pnpm-lock.yaml file, and update all deps, nothing works... Please, try to build for Cloudflare.

Build log fail

2024-02-29T10:46:14.675867851Z  Cloning repository...
2024-02-29T10:46:15.817757913Z  From https://github.com/dejurin/pwa-example
2024-02-29T10:46:15.818414405Z   * branch            13c07dbc1f5f9e9e5e134c65a5fad4f03572787e -> FETCH_HEAD
2024-02-29T10:46:15.818434068Z  
2024-02-29T10:46:15.880212665Z  HEAD is now at 13c07db Update .node-version
2024-02-29T10:46:15.880493728Z  
2024-02-29T10:46:15.986002553Z  
2024-02-29T10:46:15.986690601Z  Using v2 root directory strategy
2024-02-29T10:46:16.017917111Z  Success: Finished cloning repository files
2024-02-29T10:46:16.746843789Z  Detected the following tools from environment: nodejs@18.17.1, pnpm@8.7.1
2024-02-29T10:46:17.72034778Z   Installing project dependencies: pnpm install
2024-02-29T10:46:18.536833368Z  Lockfile is up to date, resolution step is skipped
2024-02-29T10:46:18.573150688Z  Progress: resolved 1, reused 0, downloaded 0, added 0
2024-02-29T10:46:18.676341818Z  Packages: +473
2024-02-29T10:46:18.676655414Z  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2024-02-29T10:46:19.602499285Z  Progress: resolved 473, reused 0, downloaded 34, added 29
2024-02-29T10:46:20.609502575Z  Progress: resolved 473, reused 0, downloaded 231, added 226
2024-02-29T10:46:21.601956827Z  Progress: resolved 473, reused 0, downloaded 397, added 390
2024-02-29T10:46:22.60315293Z   Progress: resolved 473, reused 0, downloaded 472, added 472
2024-02-29T10:46:23.308801677Z  Progress: resolved 473, reused 0, downloaded 473, added 473, done
2024-02-29T10:46:23.579538619Z  .../sharp@0.32.6/node_modules/sharp install$ (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
2024-02-29T10:46:23.839255698Z  .../sharp@0.32.6/node_modules/sharp install: sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-linux-x64.tar.br
2024-02-29T10:46:24.581973176Z  .../sharp@0.32.6/node_modules/sharp install: sharp: Integrity check passed for linux-x64
2024-02-29T10:46:25.238851449Z  .../sharp@0.32.6/node_modules/sharp install: Done
2024-02-29T10:46:25.331737597Z  .../esbuild@0.17.19/node_modules/esbuild postinstall$ node install.js
2024-02-29T10:46:25.33222948Z   .../esbuild@0.19.12/node_modules/esbuild postinstall$ node install.js
2024-02-29T10:46:25.332693538Z  .../esbuild@0.18.20/node_modules/esbuild postinstall$ node install.js
2024-02-29T10:46:25.413664247Z  .../node_modules/workerd postinstall$ node install.js
2024-02-29T10:46:25.454400927Z  .../esbuild@0.17.19/node_modules/esbuild postinstall: Done
2024-02-29T10:46:25.498908901Z  .../esbuild@0.19.12/node_modules/esbuild postinstall: Done
2024-02-29T10:46:25.525594378Z  .../esbuild@0.18.20/node_modules/esbuild postinstall: Done
2024-02-29T10:46:25.56326139Z   .../node_modules/workerd postinstall: Done
2024-02-29T10:46:26.196556951Z  .../sharp@0.33.2/node_modules/sharp install$ node install/check
2024-02-29T10:46:26.346857447Z  .../sharp@0.33.2/node_modules/sharp install: Done
2024-02-29T10:46:26.476881955Z  
2024-02-29T10:46:26.477224116Z  devDependencies:
2024-02-29T10:46:26.477454961Z  + @builder.io/qwik 1.4.5
2024-02-29T10:46:26.477682651Z  + @builder.io/qwik-city 1.4.5
2024-02-29T10:46:26.477971167Z  + @qwikdev/pwa 0.0.4
2024-02-29T10:46:26.478838721Z  + @types/eslint 8.56.5
2024-02-29T10:46:26.478857865Z  + @types/node 20.11.22
2024-02-29T10:46:26.47886393Z   + @typescript-eslint/eslint-plugin 6.21.0
2024-02-29T10:46:26.478868273Z  + @typescript-eslint/parser 6.21.0
2024-02-29T10:46:26.478872451Z  + @vite-pwa/assets-generator 0.2.4
2024-02-29T10:46:26.479262839Z  + eslint 8.57.0
2024-02-29T10:46:26.480167313Z  + eslint-plugin-qwik 1.4.5
2024-02-29T10:46:26.480334579Z  + fast-glob 3.3.2
2024-02-29T10:46:26.480530861Z  + prettier 3.2.5
2024-02-29T10:46:26.480774532Z  + typescript 5.3.3
2024-02-29T10:46:26.480968536Z  + undici 5.28.3
2024-02-29T10:46:26.481021372Z  + vite 4.5.2
2024-02-29T10:46:26.481231396Z  + vite-tsconfig-paths 4.3.1
2024-02-29T10:46:26.481297613Z  + wrangler 3.30.0
2024-02-29T10:46:26.481662611Z  
2024-02-29T10:46:26.494238144Z  Done in 8.3s
2024-02-29T10:46:26.602171663Z  Executing user command: pnpm run build
2024-02-29T10:46:27.385057161Z  
2024-02-29T10:46:27.385873656Z  > example@ build /opt/buildhome/repo
2024-02-29T10:46:27.385894019Z  > qwik build
2024-02-29T10:46:27.385899146Z  
2024-02-29T10:46:27.495460046Z  
2024-02-29T10:46:27.496064425Z        ............
2024-02-29T10:46:27.496287304Z      .::: :--------:.
2024-02-29T10:46:27.49638399Z      .::::  .:-------:.
2024-02-29T10:46:27.496498048Z    .:::::.   .:-------.
2024-02-29T10:46:27.496606525Z    ::::::.     .:------.
2024-02-29T10:46:27.496762169Z   ::::::.        :-----:
2024-02-29T10:46:27.496786764Z   ::::::.       .:-----.
2024-02-29T10:46:27.496978818Z    :::::::.     .-----.
2024-02-29T10:46:27.497688077Z     ::::::::..   ---:.
2024-02-29T10:46:27.497725197Z      .:::::::::. :-:.
2024-02-29T10:46:27.497730263Z       ..::::::::::::
2024-02-29T10:46:27.497734637Z               ...::::
2024-02-29T10:46:27.497737756Z       
2024-02-29T10:46:27.497740857Z  
2024-02-29T10:46:27.497748091Z  
2024-02-29T10:46:27.497836678Z  pnpm run build.client
2024-02-29T10:46:27.497882307Z  pnpm run build.server
2024-02-29T10:46:27.498059415Z  
2024-02-29T10:46:28.013439697Z  
2024-02-29T10:46:28.013693717Z  > example@ build.client /opt/buildhome/repo
2024-02-29T10:46:28.013883179Z  > vite build
2024-02-29T10:46:28.014059053Z  
2024-02-29T10:46:28.395457804Z  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
2024-02-29T10:46:29.229356148Z  vite v4.5.2 building for production...
2024-02-29T10:46:29.374991534Z  transforming...
2024-02-29T10:46:29.566201966Z  munmap_chunk(): invalid pointer
2024-02-29T10:46:29.582554916Z  Aborted
2024-02-29T10:46:29.588858366Z   ELIFECYCLE  Command failed with exit code 134.
2024-02-29T10:46:29.639025963Z   ELIFECYCLE  Command failed with exit code 1.
2024-02-29T10:46:29.668404129Z  Failed: Error while executing user command. Exited with error code: 1
2024-02-29T10:46:29.680114675Z  Failed: build command exited with code: 1
2024-02-29T10:46:30.646625Z Failed: error occurred while running build command
Aslemammad commented 8 months ago

Thank you, will check it soon

Aslemammad commented 8 months ago

cc @AmirSa12

AmirSa12 commented 8 months ago

Hi @dejurin, I forgot to update the example, although this should've worked for you, because I configured the files in the root workspace. anyways, I will update the example. to let you know, just add "resolutions": { "sharp": "0.32.6" } in the package.json file, and this should resolve the issue. let me know if you encounter any other issues!

dejurin commented 8 months ago

Thank you. After a few hours, I will test my production. I will text.

dejurin commented 8 months ago

Fail.

2024-03-03T21:26:01.839927Z Cloning repository...
2024-03-03T21:26:02.877567Z From https://github.com/dejurin/pwa-example
2024-03-03T21:26:02.878117Z  * branch            365d29d326d9dee8ee98919842bebac988bd57ae -> FETCH_HEAD
2024-03-03T21:26:02.878247Z 
2024-03-03T21:26:02.932271Z HEAD is now at 365d29d 18
2024-03-03T21:26:02.9327Z   
2024-03-03T21:26:03.030438Z 
2024-03-03T21:26:03.030959Z Using v2 root directory strategy
2024-03-03T21:26:03.060198Z Success: Finished cloning repository files
2024-03-03T21:26:03.778636Z Detected the following tools from environment: nodejs@18.17.1, npm@9.6.7
2024-03-03T21:26:03.779331Z Installing project dependencies: npm install --progress=false
2024-03-03T21:26:15.742437Z npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
2024-03-03T21:26:15.799307Z npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
2024-03-03T21:26:22.750904Z 
2024-03-03T21:26:22.75115Z  added 486 packages, and audited 487 packages in 18s
2024-03-03T21:26:22.751312Z 
2024-03-03T21:26:22.751467Z 207 packages are looking for funding
2024-03-03T21:26:22.751599Z   run `npm fund` for details
2024-03-03T21:26:22.753092Z 
2024-03-03T21:26:22.753275Z found 0 vulnerabilities
2024-03-03T21:26:22.777618Z Executing user command: pnpm run build
2024-03-03T21:26:23.640056Z 
2024-03-03T21:26:23.640306Z > example@ build /opt/buildhome/repo
2024-03-03T21:26:23.640468Z > qwik build
2024-03-03T21:26:23.640585Z 
2024-03-03T21:26:23.724894Z 
2024-03-03T21:26:23.72515Z        ............
2024-03-03T21:26:23.725297Z     .::: :--------:.
2024-03-03T21:26:23.725485Z    .::::  .:-------:.
2024-03-03T21:26:23.725625Z   .:::::.   .:-------.
2024-03-03T21:26:23.72574Z    ::::::.     .:------.
2024-03-03T21:26:23.725976Z  ::::::.        :-----:
2024-03-03T21:26:23.72625Z   ::::::.       .:-----.
2024-03-03T21:26:23.726383Z   :::::::.     .-----.
2024-03-03T21:26:23.726516Z    ::::::::..   ---:.
2024-03-03T21:26:23.726653Z     .:::::::::. :-:.
2024-03-03T21:26:23.726785Z      ..::::::::::::
2024-03-03T21:26:23.726898Z              ...::::
2024-03-03T21:26:23.727019Z      
2024-03-03T21:26:23.727164Z 
2024-03-03T21:26:23.727586Z 
2024-03-03T21:26:23.72787Z  pnpm run build.client
2024-03-03T21:26:23.728062Z pnpm run build.server
2024-03-03T21:26:23.728218Z 
2024-03-03T21:26:24.328306Z 
2024-03-03T21:26:24.328618Z > example@ build.client /opt/buildhome/repo
2024-03-03T21:26:24.328799Z > vite build
2024-03-03T21:26:24.328983Z 
2024-03-03T21:26:24.570667Z The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
2024-03-03T21:26:25.292697Z vite v5.1.4 building for production...
2024-03-03T21:26:25.456341Z transforming...
2024-03-03T21:26:25.538528Z munmap_chunk(): invalid pointer
2024-03-03T21:26:25.547929Z Aborted
2024-03-03T21:26:25.552407Z  ELIFECYCLE  Command failed with exit code 134.
2024-03-03T21:26:25.593662Z  ELIFECYCLE  Command failed with exit code 1.
2024-03-03T21:26:25.622444Z Failed: Error while executing user command. Exited with error code: 1
2024-03-03T21:26:25.635758Z Failed: build command exited with code: 1
2024-03-03T21:26:26.456146Z Failed: error occurred while running build command

package.json

{
  "name": "example",
  "description": "Demo App with Routing built-in (recommended)",
  "engines": {
    "node": ">=15.0.0"
  },
  "trustedDependencies": [
    "sharp"
  ],
  "resolutions": {
    "sharp": "0.32.6"
  },
  "scripts": {
    "build": "qwik build",
    "build.client": "vite build",
    "build.preview": "vite build --ssr src/entry.preview.tsx",
    "build.server": "vite build -c adapters/cloudflare-pages/vite.config.ts",
    "deploy": "wrangler pages publish ./dist",
    "dev": "vite --mode ssr",
    "dev.custom": "CUSTOM_CONFIG=true vite --mode ssr",
    "dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
    "fmt": "prettier --write .",
    "fmt.check": "prettier --check .",
    "preview": "qwik build preview && vite preview",
    "serve": "wrangler pages dev ./dist",
    "start": "vite --open --mode ssr",
    "qwik": "qwik"
  },
  "devDependencies": {
    "@builder.io/qwik": "^1.4.5",
    "@builder.io/qwik-city": "^1.4.5",
    "@qwikdev/pwa": "^0.0.4",
    "@types/eslint": "^8.56.5",
    "@types/node": "^20.11.24",
    "@typescript-eslint/eslint-plugin": "^7.1.0",
    "@typescript-eslint/parser": "^7.1.0",
    "@vite-pwa/assets-generator": "^0.2.4",
    "eslint": "^8.57.0",
    "eslint-plugin-qwik": "^1.4.5",
    "fast-glob": "^3.3.2",
    "prettier": "^3.2.5",
    "typescript": "^5.3.3",
    "undici": "^6.7.0",
    "vite": "^5.1.4",
    "vite-tsconfig-paths": "^4.3.1",
    "wrangler": "^3.30.1"
  }
}
AmirSa12 commented 8 months ago

@dejurin it's green in here: https://github.com/AmirSa12/pwa-example-bug

dejurin commented 8 months ago

Thank you.

dejurin commented 8 months ago

So, I got successful result. Thank you all who helped me.

Conclusion

PNPM

  1. Need set resolutions w/ "sharp": "0.32.6"
  2. It is necessary to create a file npm-lock.yaml by pnpm install --no-frozen-lockfile

Bun

  1. Need set resolutions w/ "sharp": "0.32.6"
  2. Set ENV BUN_VERSION=1.0.30 in Cloudflare. Cuz the default version of bun - 1.0.1 doesn't work, for example, I've installed the latest version so far.

package.json

{
  "name": "example",
  "description": "Demo App with Routing built-in (recommended)",
  "engines": {
    "node": ">=18.0.0"
  },
  "trustedDependencies": [
    "sharp"
  ],
  "scripts": {
    "build": "qwik build",
    "build.client": "vite build",
    "build.preview": "vite build --ssr src/entry.preview.tsx",
    "build.server": "vite build -c adapters/cloudflare-pages/vite.config.ts",
    "deploy": "wrangler pages publish ./dist",
    "dev": "vite --mode ssr",
    "dev.custom": "CUSTOM_CONFIG=true vite --mode ssr",
    "dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
    "fmt": "prettier --write .",
    "fmt.check": "prettier --check .",
    "preview": "qwik build preview && vite preview",
    "serve": "wrangler pages dev ./dist",
    "start": "vite --open --mode ssr",
    "qwik": "qwik"
  },
  "devDependencies": {
    "@builder.io/qwik": "^1.5.0",
    "@builder.io/qwik-city": "^1.5.0",
    "@qwikdev/pwa": "^0.0.4",
    "@types/eslint": "^8.56.5",
    "@types/node": "^20.11.24",
    "@typescript-eslint/eslint-plugin": "^7.1.1",
    "@typescript-eslint/parser": "^7.1.1",
    "@vite-pwa/assets-generator": "^0.2.4",
    "eslint": "^8.57.0",
    "eslint-plugin-qwik": "^1.5.0",
    "fast-glob": "^3.3.2",
    "prettier": "^3.2.5",
    "typescript": "^5.3.3",
    "undici": "^6.7.0",
    "vite": "^5.1.5",
    "vite-tsconfig-paths": "^4.3.1",
    "wrangler": "^3.30.1"
  },
  "resolutions": {
    "sharp": "0.32.6"
  }
}
Aslemammad commented 8 months ago

I appreciate your patience and the helpful reproductions! And thanks to @AmirSa12 for the hard work on the PR too.