Getting an error -[ERR_INVALID_ARG_TYPE]: The "path" argument

Hi,

Trying to NPM install. I am getting following error. “error The “path” argument must be of type string or an instance of Buffer or URL. Received null”

Anybody why this is happening?
559 timing auditReport:getReport Completed in 738ms
560 silly audit report {}
561 timing auditReport:init Completed in 0ms
562 timing reify:audit Completed in 739ms
563 timing reify:trash Completed in 996ms
564 timing command:install Completed in 6192ms
565 verbose stack TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string or an instance of Buffer or URL. Received null
565 verbose stack at open (node:fs:551:10)
565 verbose stack at go$open (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:357:14)
565 verbose stack at Object.open (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:354:12)
565 verbose stack at writeFile (node:fs:2169:6)
565 verbose stack at go$writeFile (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:138:14)
565 verbose stack at writeFile (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:135:12)
565 verbose stack at node:internal/util:364:7
565 verbose stack at new Promise ()
565 verbose stack at writeFile (node:internal/util:350:12)
565 verbose stack at Shrinkwrap.save (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js:1140:7)
566 verbose cwd /home/maghof/strapi/strapdock
567 verbose Linux 5.10.0-19-amd64
568 verbose node v16.19.1
569 verbose npm v8.19.3
570 error code ERR_INVALID_ARG_TYPE
571 error The “path” argument must be of type string or an instance of Buffer or URL. Received null
572 verbose exit 1
573 timing npm Completed in 6303ms
574 verbose unfinished npm timer reify 1679918127877
575 verbose unfinished npm timer reify:save 1679918133820
576 verbose code 1
577 error A complete log of this run can be found in:
577 error /root/.npm/_logs/2023-03-27T11_55_27_768Z-debug-0.log

/M

What version of npm and node are you using.
Also what is the command you are trying to run.

Trying to do an “NPM Install”.

NPM 8.19.3
NODEJS 16.19.1

/M

Could you please try remove package-lock.json / yarn.lock also node_modules and then do npm install again ? :slight_smile:

Thanks E! It solved that issue.

/M

1 Like

Glad you got it resolved.

Same problem here

  • removed package-lock.json
  • removed node_modules
    → Still same error :see_no_evil:
    I’m on Node v18.16.1 and npm 9.5.1

Any advice anyone?

Thanks!
Will