Cannot install module via HTTP Admin API

Hi all,

I'm trying to install a custom module via the HTTP Admin API but with no success as I keep getting:

{
  "code": "MODULE_NOT_FOUND",
  "message": "Cannot find module '[ABSOLUTE PATH PATH TO MY MODULE DIR]'"
}

On node-red logs shows:

[0] 14 Jan 20:27:49 - [info] Installing module: [ABSOLUTE PATH PATH TO MY MODULE DIR], version: latest
[0] 14 Jan 20:27:49 - [debug] npm.cmd install --no-audit --no-update-notifier --save --save-prefix="~" --production [ABSOLUTE PATH PATH TO MY MODULE DIR]
[0] 14 Jan 20:27:51 - [debug] [out] + teste@0.0.1
[0] 14 Jan 20:27:51 - [debug] [out] updated 1 package in 0.12s
[0] 14 Jan 20:27:51 - [debug] rc=0
[0] 14 Jan 20:27:51 - [info] Installed module: [ABSOLUTE PATH PATH TO MY MODULE DIR]

I'm executing:

POST http://{{host}}/red/nodes
content-type: application/json
Accept: application/json
{
    "module":"[ABSOLUTE PATH PATH TO MY MODULE DIR]"
}

If I run the npm install [ABSOLUTE PATH PATH TO MY MODULE DIR] it works.

Any thoughts?
Thanks

Are you using windows? The fact it says npm.cmd makes me thing you are.

Can you share the actual path you are using? I wonder if there's a windows path separator issue here where we are failing to detect the path properly.

The log output says it has installed the module. Can you have a look in .node-red/node_modules to see if the module has been installed?

Hi Nick, thanks for the quick reply.

Yes I'm running on Windows. I'm also running node-red in "embedded mode".

The HTTP request is:

POST http://{{host}}/red/nodes
content-type: application/json
Accept: application/json
{
    "module":"C:\\@Work\\00_projects\\pxp\\src\\temp\\.gen\\teste"
}

node-red logs:

[0] 15 Jan 08:34:08 - [info] Installing module: C:\@Work\00_projects\pxp\src\temp\.gen\teste, version: latest[0] 15 Jan 08:34:08 - [debug] npm.cmd install --no-audit --no-update-notifier --save --save-prefix="~" --production C:\@Work\00_projects\pxp\src\temp\.gen\teste
[0] 15 Jan 08:34:10 - [debug] [out] + teste@0.0.1
[0] 15 Jan 08:34:10 - [debug] [out] added 2 packages from 2 contributors in 0.09s
[0] 15 Jan 08:34:10 - [debug] rc=0
[0] 15 Jan 08:34:10 - [info] Installed module: C:\@Work\00_projects\pxp\src\temp\.gen\teste

And the .node-red/node_modules:
Code_ErKN43Z7EJ

Thanks for the help.