Can't spawn npm on Windows 11

I am attempting to run my RAG server locally and all of the code is working except the runFrontend() portion which returns an error:

Stack trace:
NotFound: Failed to spawn ‘npm’: program not found
at spawnSync (ext:runtime/40_process.js:408:18)
at Command.outputSync (ext:runtime/40_process.js:464:12)
at runFrontend (file:///C:/Users/quiks/RAG/ServerCode/utils.ts:9:10)
at :1:22

This error comes from the utils.ts file when it attempts to run the following code:
const runFrontend = () => {

let npmInstall = new Deno.Command(
  "npm", {
      args: ["ci"]

let result = new Deno.Command(
        args: ["run","dev"]
//    return new TextDecoder().decode(result.stdout)
return {
  [Symbol.for("Jupyter.display")]() {
      return {
          "text/plan": Deno.env.get("DLAI_LOCAL_URL").replace(/\{\}/, Deno.env.get("PORT1")), 
	  "text/html": "Check <a href=" + Deno.env.get("DLAI_LOCAL_URL").replace(/\{\}/, Deno.env.get("PORT1")) + " target='_blank'>"+ Deno.env.get("DLAI_LOCAL_URL").replace(/\{\}/, Deno.env.get("PORT1")) + "</a> to see the results" 


I have set all folders in the env path and reinstalled nodes.js multiple times yet am still unable to locate npm. Any suggestions?

1 Like

same issue for me on Win10

Also, just an observation:

If we run the command npm ci, or npm run dev on cmd. It runs normally.

It seems the Deno is not getting permission to run npm command.