Skip to content

Commit a937040

Browse files
Fix spawn npm ENOENT (#96)
* add back changes from previous pr * replace tab with 2 space * switch back to spawn * revert the changes in package lock * remove tsconfig and use normalizePath() * remove my changes of normalizePath() * add space * add changeset --------- Co-authored-by: Dario Piotrowicz <dario@cloudflare.com>
1 parent da15971 commit a937040

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.changeset/blue-plants-thank.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/next-on-pages": patch
3+
---
4+
5+
fixed npx not working on windows

src/index.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ const buildVercel = async () => {
5151
console.log("⚡️ Building project with 'npx vercel build'...");
5252
console.log("⚡️");
5353

54-
const vercelBuild = spawn("npx", ["vercel", "build"]);
55-
54+
const npx = process.platform === "win32" ? "npx.cmd" : "npx";
55+
const vercelBuild = spawn(npx, ["vercel", "build"]);
5656
vercelBuild.stdout.on("data", (data) => {
5757
const lines: string[] = data.toString().split("\n");
5858
lines.map((line) => {
@@ -496,10 +496,7 @@ const transform = async ({
496496
await build({
497497
entryPoints: [join(__dirname, "../templates/_worker.js")],
498498
bundle: true,
499-
inject: [
500-
join(__dirname, "../templates/_worker.js/globals.js"),
501-
functionsFile,
502-
],
499+
inject: [join(__dirname, "../templates/_worker.js/globals.js"), functionsFile],
503500
target: "es2021",
504501
platform: "neutral",
505502
define: {

0 commit comments

Comments
 (0)