I’m having a problem where my pnpm function can’t be built and it fails to deploy.
The problem is in esbuild I think.
I think what’s happening is that pnpm doesn’t expose transitive dependencies directly in the node_modules directory.
I think I have to hoist ALL the packages from google storage that it uses because they’re not hoisted like npm.
Do you guys have a workaround for this?
I tried to cleanup my package dependencies but I’d like to avoid having to manually put all the dependencies in my package.json
Also, I can use the npm strategy with pnpm to ‘hoist’ everything flat (like in npm) but that would/could cause other issues.
Another way to put this is that your esbuild system is broken and you should fix it
- I did a TON of research to figure out if this was an existing issue or not and couldn’t find any relevant documentation.
site name: euphonious-kangaroo-29911b.netlify.app
Here are my logs:
8:08:18 PM: Netlify Build
8:08:18 PM: ────────────────────────────────────────────────────────────────
8:08:18 PM:
8:08:18 PM: ❯ Version
8:08:18 PM: @netlify/build 29.56.1
8:08:18 PM:
8:08:18 PM: ❯ Flags
8:08:18 PM: accountId: 674de3e62b67981416551d19
8:08:18 PM: baseRelDir: true
8:08:18 PM: buildId: 674e84006e04a10008996a56
8:08:18 PM: deployId: 674e84006e04a10008996a58
8:08:18 PM:
8:08:18 PM: ❯ Current directory
8:08:18 PM: /opt/build/repo
8:08:18 PM:
8:08:18 PM: ❯ Config file
8:08:18 PM: No config file was defined: using default values.
8:08:18 PM:
8:08:18 PM: ❯ Context
8:08:18 PM: production
8:08:18 PM:
8:08:18 PM: Build command from Netlify app
8:08:18 PM: ────────────────────────────────────────────────────────────────
8:08:18 PM:
8:08:18 PM: $ pnpm m run build
8:08:18 PM: Scope: 8 of 9 workspace projects
8:08:18 PM: packages/aletheia-ai build$ npx tsc -b
8:08:18 PM: packages/aletheia-bot build$ tsc --build
8:08:18 PM: packages/aletheia-types build$ tsc --build
8:08:18 PM: packages/aletheia-ffmpeg build$ npx tsc -b
8:08:20 PM: packages/aletheia-types build: Done
8:08:20 PM: packages/aletheia-util build$ tsc --build
8:08:20 PM: packages/aletheia-ai build: Done
8:08:20 PM: packages/aletheia-ffmpeg build: Done
8:08:21 PM: packages/aletheia-util build: Done
8:08:25 PM: packages/aletheia-bot build: Done
8:08:25 PM: packages/aletheia-backend build$ npx tsc -b
8:08:25 PM: packages/aletheia-webapp build$ tsc -b && vite build
8:08:27 PM: packages/aletheia-webapp build: vite v6.0.2 building for production…
8:08:27 PM: packages/aletheia-webapp build: transforming…
8:08:27 PM: packages/aletheia-backend build: Done
8:08:28 PM: packages/aletheia-webapp build: ✓ 47 modules transformed.
8:08:28 PM: packages/aletheia-webapp build: rendering chunks…
8:08:28 PM: packages/aletheia-webapp build: computing gzip size…
8:08:28 PM: packages/aletheia-webapp build: dist/index.html 0.50 kB │ gzip: 0.32 kB
8:08:28 PM: packages/aletheia-webapp build: dist/assets/index-zOkyUAGe.css 1.27 kB │ gzip: 0.60 kB
8:08:28 PM: packages/aletheia-webapp build: dist/assets/index-BfNLQLH5.js 179.16 kB │ gzip: 59.40 kB
8:08:28 PM: packages/aletheia-webapp build: ✓ built in 854ms
8:08:28 PM: packages/aletheia-webapp build: Done
8:08:28 PM: packages/aletheia-backend-functions build$ npx tsc -b
8:08:29 PM: packages/aletheia-backend-functions build: Done
8:08:29 PM:
8:08:29 PM: (build.command completed in 11.3s)
8:08:29 PM:
8:08:29 PM: Functions bundling
8:08:29 PM: ────────────────────────────────────────────────────────────────
8:08:29 PM:
8:08:29 PM: Packaging Functions from packages/aletheia-backend-functions/src directory:
8:08:29 PM: - createSignedURL.ts
8:08:29 PM: - createSignedURL.js
8:08:29 PM: - hello.ts
8:08:29 PM: - hello.js
8:08:29 PM:
8:08:29 PM:
8:08:29 PM: Dependencies installation error
8:08:29 PM: ────────────────────────────────────────────────────────────────
8:08:29 PM:
8:08:29 PM: Error message
8:08:29 PM: A Netlify Function failed to require one of its dependencies.
8:08:29 PM: Please make sure it is present in the site’s top-level “package.json”.
8:08:29 PM: In file “/opt/build/repo/packages/aletheia-backend-functions/src/createSignedURL.js”
8:08:29 PM: Cannot find module ‘@google-cloud/paginator’
8:08:29 PM: Require stack:
8:08:29 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/resolve.js
8:08:29 PM:
8:08:29 PM: Resolved config
8:08:29 PM: build:
8:08:29 PM: command: pnpm m run build
8:08:29 PM: commandOrigin: ui
8:08:29 PM: publish: /opt/build/repo/packages/aletheia-webapp/dist
8:08:29 PM: publishOrigin: ui
8:08:29 PM: functionsDirectory: /opt/build/repo/packages/aletheia-backend-functions/src
8:08:29 PM: redirects:
8:08:30 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
8:08:30 PM: - from: /api/*
status: 200
to: /.netlify/functions/:splat
- from: /*
status: 200
to: /index.html
8:08:30 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:08:30 PM: Failing build: Failed to build site
8:08:30 PM: Finished processing build request in 40.068s
- We need to know your netlify site name. Example:
gifted-antelope-58b104.netlify.app
- DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
- Build problems? Link or paste the FULL build log & build settings screenshot
- Did you try Ask Netlify, our generative AI chatbot, before posting? It pulls info from Support Guides and recent solved forums posts.
The better the post - the faster the answer.