TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
when i use pm2 run .exe in windows, it shows error below
pm2 start sopei-extension.exe --name aaa
node:internal/validators:120
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:372:5)
at validateString (node:internal/validators:120:11)
at Object.resolve (node:path:167:9)
at resolveMainPath (node:internal/modules/run_main:19:40)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:71:24)
at node:internal/main/run_main_module:17:47 {
code: 'ERR_INVALID_ARG_TYPE'
}
How could we reproduce this issue?
Supporting information
# Run the following commands
$ pm2 report
--- PM2 report ----------------------------------------------------------------
Date : Thu Jul 11 2024 17:23:16 GMT+0800 (中国标准时间)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.4.2
node version : 16.15.0
node path : not found
argv : D:\Software\nvm\nodejs\node.exe,D:\Software\nvm\nvm\v16.15.0\node_global\node_modules\pm2\lib\Daemon.js
argv0 : node
user : undefined
uid : N/A
gid : N/A
uptime : 322min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.4.2
node version : 16.15.0
node path : not found
argv : D:\Software\nvm\nodejs\node.exe,D:\Software\nvm\nodejs\node_global\node_modules\pm2\bin\pm2,report
argv0 : node
user : 94391
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : win32
type : Windows_NT
cpus : Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
cpus nb : 12
freemem : 15544176640
totalmem : 33985073152
home : C:\Users\94391
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ aaa │ default │ N/A │ fork │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ 94391 │ disabled │
└────┴────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
C:\Users\94391\.pm2\pm2.log last 20 lines:
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] exited with code [1] via signal [SIGINT]
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] starting in -fork mode-
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] online
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] exited with code [1] via signal [SIGINT]
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] starting in -fork mode-
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] online
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] exited with code [1] via signal [SIGINT]
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] starting in -fork mode-
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] online
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] exited with code [1] via signal [SIGINT]
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] starting in -fork mode-
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] online
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] exited with code [1] via signal [SIGINT]
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] starting in -fork mode-
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] online
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] exited with code [1] via signal [SIGINT]
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] starting in -fork mode-
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] online
PM2 | 2024-07-11T17:22:58: PM2 log: App [aaa:0] exited with code [1] via signal [SIGINT]
PM2 | 2024-07-11T17:22:58: PM2 log: Script D:\WXWork\1688851197128353\Cache\File\2024-07\sopei-extension.exe had too many unstable restarts (16). Stopped. "errored"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing pm2 start sopei-extension.exe --name aaa on Windows with the reported Node.js and PM2 versions, then trace the resolveMainPath failure shown in the Node.js stack. Done means the executable can be started without the undefined path error and does not enter repeated unstable restarts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100