I'm using Bun, it's specified on package.json, but pages tries to download with npm

Hey, I have a NextJS website that I'm trying to deploy to cf pages. I could to it through wrangler, but I want to have builds on pushes, so I want to build through cf. I'm using Bun, and it's specified in the package.json, but for some reason, cf decides to run npm install, and fails. package.json
{
"name": "X",
"devDependencies": {
"turbo": "2.0.9",
"typescript": "5.5.2"
},
"engines": {
"node": ">=20.12.0"
},
"packageManager": "[email protected]",
"private": true,
"scripts": {
...
},
"workspaces": [
"packages/*",
"tooling/*",
"apps/*"
]
}
{
"name": "X",
"devDependencies": {
"turbo": "2.0.9",
"typescript": "5.5.2"
},
"engines": {
"node": ">=20.12.0"
},
"packageManager": "[email protected]",
"private": true,
"scripts": {
...
},
"workspaces": [
"packages/*",
"tooling/*",
"apps/*"
]
}
9 Replies
Pol
PolOP4mo ago
CF Pages logs:
2024-08-24T14:44:58.79547Z Cloning repository...
...
2024-08-24T14:45:01.465903Z Found wrangler.toml file. Reading build configuration...
2024-08-24T14:45:01.47236Z pages_build_output_dir: .vercel/output/static
2024-08-24T14:45:01.472518Z Build environment variables:
2024-08-24T14:45:01.472674Z - ENVIRONMENT: production
2024-08-24T14:45:01.559448Z Successfully read wrangler.toml file.
2024-08-24T14:45:02.973901Z Detected the following tools from environment: [email protected], [email protected], [email protected]
2024-08-24T14:45:02.974408Z Installing bun 1.1.20
2024-08-24T14:45:03.105868Z Downloading Bun v1.1.20...
2024-08-24T14:45:04.432517Z Archive: /tmp/asdf-bun.xlvN/bun.zip
2024-08-24T14:45:05.155904Z inflating: /opt/buildhome/.asdf/downloads/bun/1.1.20/bun
2024-08-24T14:45:05.224589Z Installing Bun v1.1.20...
2024-08-24T14:45:05.326078Z Bun v1.1.20 is installed successfully!
2024-08-24T14:45:05.823032Z Installing project dependencies: npm install --progress=false
2024-08-24T14:45:07.661233Z npm ERR! code EUNSUPPORTEDPROTOCOL
2024-08-24T14:45:07.662731Z npm ERR! Unsupported URL Type "workspace:": workspace:*
2024-08-24T14:45:07.664031Z
2024-08-24T14:45:07.664273Z npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2024-08-24T14_45_06_551Z-debug-0.log
2024-08-24T14:45:07.676242Z Error: Exit with error code: 1
2024-08-24T14:45:07.676386Z at ChildProcess.<anonymous> (/snapshot/dist/run-build.js)
2024-08-24T14:45:07.676484Z at Object.onceWrapper (node:events:652:26)
2024-08-24T14:45:07.676621Z at ChildProcess.emit (node:events:537:28)
2024-08-24T14:45:07.676718Z at ChildProcess._handle.onexit (node:internal/child_process:291:12)
2024-08-24T14:45:07.689626Z Failed: build command exited with code: 1
2024-08-24T14:45:08.64283Z Failed: error occurred while running build command
2024-08-24T14:44:58.79547Z Cloning repository...
...
2024-08-24T14:45:01.465903Z Found wrangler.toml file. Reading build configuration...
2024-08-24T14:45:01.47236Z pages_build_output_dir: .vercel/output/static
2024-08-24T14:45:01.472518Z Build environment variables:
2024-08-24T14:45:01.472674Z - ENVIRONMENT: production
2024-08-24T14:45:01.559448Z Successfully read wrangler.toml file.
2024-08-24T14:45:02.973901Z Detected the following tools from environment: [email protected], [email protected], [email protected]
2024-08-24T14:45:02.974408Z Installing bun 1.1.20
2024-08-24T14:45:03.105868Z Downloading Bun v1.1.20...
2024-08-24T14:45:04.432517Z Archive: /tmp/asdf-bun.xlvN/bun.zip
2024-08-24T14:45:05.155904Z inflating: /opt/buildhome/.asdf/downloads/bun/1.1.20/bun
2024-08-24T14:45:05.224589Z Installing Bun v1.1.20...
2024-08-24T14:45:05.326078Z Bun v1.1.20 is installed successfully!
2024-08-24T14:45:05.823032Z Installing project dependencies: npm install --progress=false
2024-08-24T14:45:07.661233Z npm ERR! code EUNSUPPORTEDPROTOCOL
2024-08-24T14:45:07.662731Z npm ERR! Unsupported URL Type "workspace:": workspace:*
2024-08-24T14:45:07.664031Z
2024-08-24T14:45:07.664273Z npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2024-08-24T14_45_06_551Z-debug-0.log
2024-08-24T14:45:07.676242Z Error: Exit with error code: 1
2024-08-24T14:45:07.676386Z at ChildProcess.<anonymous> (/snapshot/dist/run-build.js)
2024-08-24T14:45:07.676484Z at Object.onceWrapper (node:events:652:26)
2024-08-24T14:45:07.676621Z at ChildProcess.emit (node:events:537:28)
2024-08-24T14:45:07.676718Z at ChildProcess._handle.onexit (node:internal/child_process:291:12)
2024-08-24T14:45:07.689626Z Failed: build command exited with code: 1
2024-08-24T14:45:08.64283Z Failed: error occurred while running build command
Thank you in advance 😄
Erisa
Erisa4mo ago
does a package-lock.json exist?
Pol
PolOP4mo ago
nop only the bun one let me send you some screenshots ls on root
LICENSE bun.lockb packages turbo.json
README.md node_modules tooling
apps package.json turbo
LICENSE bun.lockb packages turbo.json
README.md node_modules tooling
apps package.json turbo
ls on apps/nextjs
README.md sentry.client.config.ts
cloudflare-env.d.ts sentry.edge.config.ts
eslint.config.js sentry.server.config.ts
next-env.d.ts src
next.config.js tailwind.config.ts
node_modules tsconfig.json
package.json vercel.json
postcss.config.cjs wrangler.toml
public
README.md sentry.client.config.ts
cloudflare-env.d.ts sentry.edge.config.ts
eslint.config.js sentry.server.config.ts
next-env.d.ts src
next.config.js tailwind.config.ts
node_modules tsconfig.json
package.json vercel.json
postcss.config.cjs wrangler.toml
public
it's a monorepo
Pol
PolOP4mo ago
No description
Pol
PolOP4mo ago
I'll try to force it to use pnpm instead of bun and see if it changes anything Hey @Erisa (sorry for the ping 🙏), still happening on another project, same issue. Pages installs bun, and then proceeds to use npm install. I recreated it accidentally using a monorepo with bun, and setting the Root directory. Should I report it somewhere? I guess is that it initially detects bun lockfile, but when proceeds to install, it doesn't detect the lockfile on the set root directory (since there is none, it's a monorepo)
Jeff
Jeff3mo ago
Yeah this is happening for me too
Radoš
Radoš3mo ago
@Pol @Jeff did you set build command in CF Workers UI?
Tenshi
Tenshi2w ago
did you manage to solve this @Pol ?
Pol
PolOP2w ago
I ended up using pnpm, since it's more reliable, and just install bun as a package for some stuff
Want results from more Discord servers?
Add your server