protomaps / PMTiles

Cloud-optimized + compressed single-file tile archives for vector and raster maps
https://protomaps.com/docs/pmtiles/
BSD 3-Clause "New" or "Revised" License
2.08k stars 123 forks source link

✘ [ERROR] Could not resolve "fflate" #455

Open renefournier opened 1 month ago

renefournier commented 1 month ago

Trying to npm run build in /serverless/cloudflare and I get these warnings & errors:

rm -rf node_modules && npm update && npm run build
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead

added 90 packages, and audited 91 packages in 3s

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

found 0 vulnerabilities

> pmtiles-cloudflare@0.0.1 build
> wrangler deploy --dry-run --outdir dist

 ⛅️ wrangler 3.78.4
-------------------

✘ [ERROR] Could not resolve "fflate"

    ../../js/index.ts:1:31:
      1 │ import { decompressSync } from "fflate";
        ╵                                ~~~~~~~~

  You can mark the path "fflate" as external to exclude it from the bundle, which will remove this error.

✘ [ERROR] Could not resolve "fflate"

    ../../js/v2.ts:1:31:
      1 │ import { decompressSync } from "fflate";
        ╵                                ~~~~~~~~

  You can mark the path "fflate" as external to exclude it from the bundle, which will remove this error.

✘ [ERROR] Could not resolve "fflate"

    ../../js/index.ts:1:31:
      1 │ import { decompressSync } from "fflate";
        ╵                                ~~~~~~~~

  You can mark the path "fflate" as external to exclude it from the bundle, which will remove this error.

✘ [ERROR] Could not resolve "fflate"

    ../../js/v2.ts:1:31:
      1 │ import { decompressSync } from "fflate";
        ╵                                ~~~~~~~~

  You can mark the path "fflate" as external to exclude it from the bundle, which will remove this error.

✘ [ERROR] Build failed with 2 errors:

  ../../js/index.ts:1:31: ERROR: Could not resolve "fflate"
  ../../js/v2.ts:1:31: ERROR: Could not resolve "fflate"

🪵  Logs were written to "/Users/rene/Library/Preferences/.wrangler/logs/wrangler-2024-09-18_17-31-00_388.log"

Log output:

--- 2024-09-18T17:31:00.456Z debug
🪵  Writing logs to "/Users/rene/Library/Preferences/.wrangler/logs/wrangler-2024-09-18_17-31-00_388.log"
---

--- 2024-09-18T17:31:00.456Z debug
Failed to load .env file ".env": Error: ENOENT: no such file or directory, open '.env'
    at Object.openSync (node:fs:581:18)
    at Object.readFileSync (node:fs:457:35)
    at tryLoadDotEnv (/Users/rene/Desktop/PMTiles/serverless/cloudflare/node_modules/wrangler/wrangler-dist/cli.js:158087:72)
    at loadDotEnv (/Users/rene/Desktop/PMTiles/serverless/cloudflare/node_modules/wrangler/wrangler-dist/cli.js:158096:12)
    at /Users/rene/Desktop/PMTiles/serverless/cloudflare/node_modules/wrangler/wrangler-dist/cli.js:213533:20
    at /Users/rene/Desktop/PMTiles/serverless/cloudflare/node_modules/wrangler/wrangler-dist/cli.js:179284:16
    at maybeAsyncResult (/Users/rene/Desktop/PMTiles/serverless/cloudflare/node_modules/wrangler/wrangler-dist/cli.js:177505:44)
    at /Users/rene/Desktop/PMTiles/serverless/cloudflare/node_modules/wrangler/wrangler-dist/cli.js:179283:14
    at /Users/rene/Desktop/PMTiles/serverless/cloudflare/node_modules/wrangler/wrangler-dist/cli.js:177492:22
    at Array.reduce (<anonymous>) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '.env'
}
---

--- 2024-09-18T17:31:00.461Z log

 ⛅️ wrangler 3.78.4
-------------------

---

--- 2024-09-18T17:31:00.462Z debug
No experimental flag store instantiated
---

--- 2024-09-18T17:31:00.462Z debug
Attempted to use flag "JSON_CONFIG_FILE" which has not been instantiated
---

--- 2024-09-18T17:31:00.498Z log

---

--- 2024-09-18T17:31:00.499Z error
✘ [ERROR] Build failed with 2 errors:

  ../../js/index.ts:1:31: ERROR: Could not resolve "fflate"
  ../../js/v2.ts:1:31: ERROR: Could not resolve "fflate"

---
bdon commented 1 month ago

You need to do npm install & npm run build inside PMTiles/js first. A bit awkward right now.