diff --git a/templates/index.ts b/templates/index.ts
index a1b9c46a39fd574260ae8884d53e5ddeb274446b..880af908680d079acadd4717215d9891523a6d63 100644
--- a/templates/index.ts
+++ b/templates/index.ts
@@ -247,7 +247,7 @@ const installTSTemplate = async ({
     // modify the dev script to use the custom api path
     packageJson.scripts = {
       ...packageJson.scripts,
-      dev: `NEXT_PUBLIC_CHAT_API=${customApiPath} next dev`,
+      dev: `cross-env NEXT_PUBLIC_CHAT_API=${customApiPath} next dev`,
     };
   }
 
diff --git a/templates/types/streaming/nextjs/package.json b/templates/types/streaming/nextjs/package.json
index 3160e53c098029b9eb476aa0b54741d1904bdaa1..2f23029ddfba1cefcbf6e1243f19a85f1c2453d0 100644
--- a/templates/types/streaming/nextjs/package.json
+++ b/templates/types/streaming/nextjs/package.json
@@ -37,6 +37,7 @@
     "postcss": "^8.4.32",
     "tailwindcss": "^3.3.6",
     "typescript": "^5.3.2",
-    "@types/react-syntax-highlighter": "^15.5.11"
+    "@types/react-syntax-highlighter": "^15.5.11",
+    "cross-env": "^7.0.3"
   }
-}
\ No newline at end of file
+}