• Help
  • Can't install chat plugin

Hi, I'm getting the following error when trying to install the chat plugin:
(Upon running npx rpgjs add @rpgjs/chat)

file:///C:/gamedev/rpg-app/node_modules/@rpgjs/compiler/lib/add/index.js:20
error(Failed to install '${moduleName}': ${error.message});
^

TypeError: error is not a function

I added a console.log(error) just before the line that was throwing the error and got this

Error: spawn npm ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn npm',
path: 'npm',
spawnargs: [ 'install', '@rpgjs/chat' ]
}

Which after researching seems to be a Windows-specific error that results when one tries to use childProcess.spawn('npm') on Windows. In this case, the name of the process should be npm.cmd. I have managed to solve this error for myself by changing 'npm' to 'npm.cmd', but the package author should look into correcting this upstream, as this will surely cause problems for other Windows users trying to install plugins.

Hello and welcome to the forum,

the problem has been reported here:

https://community.rpgjs.dev/d/163-plugin-installation-error-with-windows

Which after researching seems to be a Windows-specific error that results when one tries to use childProcess.spawn('npm') on Windows. In this case, the name of the process should be npm.cmd. I have managed to solve this error for myself by changing 'npm' to 'npm.cmd', but the package author should look into correcting this upstream, as this will surely cause problems for other Windows users trying to install plugins.

Thanks for the solution